开发者

Multiline Textbox Resizing in C#

开发者 https://www.devze.com 2022-12-18 00:58 出处:网络
I have two multiline textboxes separated within a splitContainer.When I drag the splitter left or right I would like the textboxes to resize accordingly.How do I do this?I am using Microsoft Visual C#

I have two multiline textboxes separated within a splitContainer. When I drag the splitter left or right I would like the textboxes to resize accordingly. How do I do this? I am using Microsoft Visual C# 2008 Express Edition. Thanks开发者_开发问答.


If you set the Dock property of textboxes to Dock.Fill, this should happen for you.


Two ways:

  1. Set the Textbox.Anchor property to Top, Left, Bottom and Right.
  2. Set the Textbox.Dock property to Fill.


I believe all you need to do is set the anchor property to Top, Left, Bottom, Right true.

Control..::.Anchor Property

Gets or sets the edges of the container to which a control is bound and determines how a control is resized with its parent.


You should Dock them in each panel.


Very late to the party but all I did was set dock to fill and Multiline to true and it filled the space.


Just set the TextBox style like this

.MultiLineTextBox
        {
            max-height: 52px;
            max-width: 163px;
            min-height: 52px;
            min-width: 163px;
        }
<asp:TextBox ID="txtremark" runat="server" CssClass ="MultiLineTextBox"

and enjoy.

0

精彩评论

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