[英]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. **我想通过C#将诸如TextBox之类的元素的大小(宽度和高度)设置为“”,但我不能。
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: 如您在此处看到的: WebControl.Width属性,该属性的类型为Unit,因此您可以例如执行以下操作:
TextBox1.Width = Unit.Percentage(100);
look at the methods and constructor of the Unit Structure for more examples. 查看单元结构的方法和构造函数以获取更多示例。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.