Reputation: 564
I am trying to change the textbox and combobox font at runtime by using this code
combobox1.Font = new Font("Tamil", 12, FontStyle.Bold);
With this code, only fontstyle is changing into bold and font size is changed into 12, but there is no change in font(language "Tamil" ).
If I change the font in property, it means it works but in runtime it's not changing.
Is there is any mistake in my coding or any other ways to change the font in runtime?
Solution
I've found out that it is typo. Below is my current code. the reason for problem is spelling mistake in font
FontFamily fontFamily = new FontFamily("senthamil");
Font font = new Font( fontFamily, 16, FontStyle.Regular, GraphicsUnit.Pixel);
cmb_Product_Code.Font = new System.Drawing.Font("senthamil", 12F,System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
Upvotes: 2
Views: 2320
Reputation: 467
Use the font family to set the font and then use the font family in the font constructor. Check the msdn link below for syntax https://msdn.microsoft.com/en-us/library/4kxs7tfz(v=vs.110).aspx
Upvotes: 1