Mamta Jain

Mamta Jain

  • NA
  • 417
  • 14.4k

Data grid view font does not changing dynamically

Dec 7 2016 11:40 PM

I have a windows form and having datagridview which binds to dataset dynamically , now in the form on the button click event I am changing the datagridview font appearance . I tried below code but its not effecting on Datagridview , only header part is being changing . Please recommended what I done wrong in coding.

My Code

private void Btn_Language_Click(object sender, EventArgs e) 
{ 
   if(DGV_View.Font.Name == "Trebuchet MS") 
   {
   DGV_View.Font = new System.Drawing.Font("NILKANTH", 12); 
   this.DGV_View.DefaultCellStyle.Font = new System.Drawing.Font("NILKANTH", 12); 
   }
   else if(DGV_View.Font.Name == "NILKANTH")
   {                    
   DGV_View.Font = new System.Drawing.Font("Trebuchet MS", 11); 
   } 
}

Answers (4)