How to increase or decrease font size of control
-
Hello friends, I am developing C#,NET windows application here i have a label now what i want that user can decrease or increase font size according to its requirement by selecting size from combo box. Thanks
What you want is to have a Font object assigned to
myLabel.Font
Have an event that fires when the selection in the comboBox is changed, get the value of the comboBox item that was selected and use it to see how big your font should be. e.g.Font myfont = new Font("Verdana", 12, FontStyle.Regular);
Will create a font of size 12. Just adjust that value to your requirements.He who makes a beast out of himself gets rid of the pain of being a man
-
Hello friends, I am developing C#,NET windows application here i have a label now what i want that user can decrease or increase font size according to its requirement by selecting size from combo box. Thanks
Hello, here is another ,its much easier but its only when you are using (RichTextBox). add your items to the ComboBox (1,2,3,4,5) it actually means 1x,2x,3x,4x,5x. Code: private void comboBox1_SelectedIndexChanged(object sender, EventArgs e) { richTextBox1.ZoomFactor = float.Parse(comboBox1.Text); } try it Regards Hamza
-
What you want is to have a Font object assigned to
myLabel.Font
Have an event that fires when the selection in the comboBox is changed, get the value of the comboBox item that was selected and use it to see how big your font should be. e.g.Font myfont = new Font("Verdana", 12, FontStyle.Regular);
Will create a font of size 12. Just adjust that value to your requirements.He who makes a beast out of himself gets rid of the pain of being a man
And dont forget to dispose the old font if you use that approach.
Blog: http://www.rogeralsing.com Projects: http://www.puzzleframework.com