如何动态调整在C#中的文本框 [英] How to dynamically resize a textbox in C#

查看:141
本文介绍了如何动态调整在C#中的文本框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新的C#用户界面。我已经创建了一个窗口,示出的第一图像上。但是,如果用户拖动窗口,使其更大,我想它使每个的RichTextBox 与它扩大,因为出的第二形象。例如,使 richTextBox4 更大成正比的窗口的大小。任何想法将不胜感激。

I am new to C# user interface. I have created a window as shown in the first image. But if the user drag the window and make it bigger, I would like for it to make each richTextBox expand with it as shown in the second image. For example, make the richTextBox4 bigger proportional to the size of the window. Any ideas would be greatly appreciated

Image1的:

图2:

Image 2:

推荐答案

您可以添加 TableLayoutPanel中到表单中。每默认情况下该面板有两个列和两行。

You can add a TableLayoutPanel to your Form. Per default this panel has two columns and two rows.

然后添加一个文本框来每个小区设置码头每个-Property 文本框填写

Then you add one TextBox to each cell and set the Dock-Property of each TextBox to Fill.

最后一步要做的要么是设置码头你的 TableLayoutPanel中来的-Property 填写或将你的 TableLayoutPanel中来的-Property 左|右|底部|顶部。那么你的小组将与表单一起调整。

The last step thing to do is either set the Dock-Property of your TableLayoutPanel to Fill or set the Anchor-Property of your TableLayoutPanel to Left | Right | Bottom | Top. Then your panel will be resized together with the Form.

所有这些步骤可以与设计师完成的。

All these steps can be done with the designer.

这篇关于如何动态调整在C#中的文本框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆