开发者

how will i know the size of user control?

开发者_高级运维How will I know the size of user control at run time?

I have a form, and I wanted to host my usercontrol on that form, and I wanted to know my user control size at run time to fix my webform size according to my user control size, so that scroll should not appear while opening the form.

How can I do that?

(actually there are multiple Usercontrols, and I am hosting a user control at run time according to a condition.)


You can expose a .Size property that would contain the height/width of user control. While rendering the control, you read the .Size and process accordingly.


Are you looking for ActualWidth / ActualHeight?

Also you should be able to set the ScrollBar policy to Auto so that it will only appear if needed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜