0
votes

Hi, guys..

I'm working on a small project with C# language in Visual Studio 2010 for my own business (Not using WPF). So, In the designer, I normally added a TextBox from ToolBox to the Form and, then normally changed the name of the TextBox from Properties Box. After that, I wanted to change Font Name & Size (The default values for Font name and size are "Tahoma" & "8.75" respectively). So, when I changed the Font name to " Times New Roman", the size of the Font was small, So I decided to change it From the default value to "11.5". So, when I changed the Font size to required value, it got changed, but the TextBox height increased. So, How can I change the Font size for the TextBox to get bigger without any effect on the height property?, In other words, how to fix the TextBox height, when I changed the Font size to get bigger?..

Thank you so much for your interest, I hope I got the problem clearer..

(Note: I haven't used a code yet. Just from the Designer)

1
It would really help if you told us what API you are using, not just what you are not using. Also, what happens if you change the TextBox height in the designer? - Dour High Arch
I don't want to change TextBox height. However, when I try to change the font size, the TextBox height changes automatically. But if I try to change the TextBox height value manually, the changing gets rejected. You can try it in Visual Studio in your laptop - Mohammed Abdullah

1 Answers

1
votes

The TextBoxBase.AutoSize property determines whether the height of the TextBox will change to fit the the size of the font. If you set it to false, you can change the height to whatever you want regardless of the font size.

This property is not visible in the Properties window, so you will have to set it in code. If the name of your TextBox is textBox, then:

textBox.AutoSize = false;