开发者

Auto-resizing disabled textbox

I have a textbox which must be disabled on my page. However, the text in the textbox is larger than the size of the textbox. As the scrollbars for the textbar are therefore disabled,开发者_运维问答 I need the textbox to automatically resize and therefore resize its parent form too.

Is this possible? If so, how?


You can achieve this by using Graphics.MeasureString and setting the size measured with this method. Although you really should think about using a Label control


I prefer using the ReadOnly property rather than disabling the text box. The user can still get to all of the text and they can copy it to the clipboard if desired.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜