简体   繁体   中英

How can I set as “auto” a control size by C#?

**I want to set as "" the size (width and heigth) of an element such as a TextBox" by C# but I can't.

I've to try anything as the following but it doesn't work:

TextBox1.Width = double.NaN;

I want to know hoy can I do that?

as you can see here: WebControl.Width Property the property is of type Unit, so you can do this for example:

TextBox1.Width = Unit.Percentage(100);

look at the methods and constructor of the Unit Structure for more examples.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM