.NET/Visual Studio 编辑器中的相对控件位置
我正在 Visual Studio 2008 的控件编辑器中编辑自定义控件
我的自定义控件左侧有数据网格视图,右侧有按钮。我希望我的控件在调整大小时始终保持按钮大小不变,并使它们与右边框对齐,并且只调整我的数据网格控件的大小,以便边框和控件之间的水平距离保持不变。 (参见下图)我记得 WinForms 和编辑器中有一些功能,例如锚点或其他功能,可以让我自动执行此操作。我只是在 MSVS 中找不到它。
==============================
| **************** *button* |
| * datagridview * *button* |
| * * *button* |
| **************** |
==============================
=================================
| ******************* *button* |
| * datagridview * *button* |
| * * *button* |
| ******************* |
================================
I am editing custom control in control editor of Visual Studio 2008
My custom control has datagrid view on the left and buttons on the right. I want my control when resized to keep button size constant always and keep them aligned to right border and only my datagrid control to be resized so that horizontal distances between borders and control remained the same. (See illustration below) I remember there was some feature in WinForms and Editor like anchors or other that would me to do that automatically. I just cannot find it in MSVS.
==============================
| **************** *button* |
| * datagridview * *button* |
| * * *button* |
| **************** |
==============================
=================================
| ******************* *button* |
| * datagridview * *button* |
| * * *button* |
| ******************* |
================================
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将按钮固定在右侧、顶部。然后将数据网格定位到左侧、右侧和顶部。
应该可以做到这一点。
查看
Control.Anchor 属性
和
表单锚
Anchor the buttons right, top. Then anchor the datagrid left, right and top.
That should do it.
Have a look at
Control.Anchor Property
and
Form Anchor