I have a new project. I drop a textbox control on it. I open up the properties window, and I can change the height and hit enter or click out of the box and it will update the designer, but when I try to change the height it resets back to the default value. Why is that? I had the same issue with a Label, but I turned off AutoSize and it allowed me to modify the values. Is there some property I can turn off to be able to modify the Height of a textbox in the design view? I'm using Visual Studio 2010 sp1. I had the same issue in Visual Studio 2008. I am new to Windows forms.
Why can't I alter the height of a TextBox control in the windows forms design view?
Asked Answered
Make the textbox multiline and it will allow you to set the height. –
Playbook
You need to set TextBox.Multiline
property as true
.
TextBox1.Multiline = true;
Yeah that makes sense. I dind't realize it was actually bound to the Font-size though. If i change the font-size it alters the textbox size which makes perfect sense. I just didn't get it right off the bat. Thanks for your help! –
Uird
Checking Multiline will allow to resize but it also allows enter(return) key in the textbox.
The Height of a non-Multiline TextBox is fixed by the size of the Font.
Reduce to textbox Font size, the TextBox will resize automatically.
What if I want to have padding inside? –
Herring
Padding like font padding? Like the space between the textbox line and first character? –
Moreland
The space between the TextBox border and the text itself, I think it's not possible right (unless you work it around with a panel or smth)? –
Herring
@Herring Try this.Link –
Moreland
Yeah I saw that, but it's got to be so haaard? Why couldn't they just add a TextBox padding property? :( –
Herring
Ya, there is nothing easy making font padding in the textbox. However, you can try making a user control and inherit a textbox and make your own textbox. That's hard too but if your pad length is like space then you can design and use your own textbox easily. –
Moreland
To resize height, you will find a drop-down menu. In here, check multiline.
And you can't resize labels at all. They automatically scale to the text.
You can resize labels though. Just set the Label's property named AutoSize to False. –
Creamer
© 2022 - 2024 — McMap. All rights reserved.