1

尝试设置几个组框的位置时遇到问题...

这是默认大小的应用程序图片,

组框在表格的中间,这就是我想要的。 在此处输入图像描述

这是另一张图片,当应用程序调整大小时,

组合框移到左侧,它们不在中间

组框的锚属性是“右”(我已经尝试了所有组合) 在此处输入图像描述

这是完全最大化时的应用程序图片,

组框移动到右侧。 在此处输入图像描述

我想在调整大小时保留标签页中间的组框。

这是一个视频:http ://www.youtube.com/watch?v=itZ85hRh9dQ&feature=youtu.be

4

1 回答 1

2

也许如果您没有找到任何其他解决方案,您可以在 form_resize 事件中替换它们。我认为您使用了 Groupboxes ......这很有帮助!你应该为单个 GroupBoxes 做这样的事情(作为你的例子中的 Program ):

groupBox1.Location.X = Me.Width / 2 - groupBox1.Width / 2

像这样用于水平方向的更多 GroupBox(作为文件和自定义)

Dim dist As Int32 = groupBoxCustomization.Location.X - groupBoxFiles.Width + groupBoxFiles.Location.X
'Get the distance between groupBoxCustomization and groupBoxFiles
Dim groupWidth As Int32 = groupBoxCustomization.Width + groupBoxCustomization.Location.X - groupBoxFiles.Location.X
'Get the total width of the GroupBoxes including the distance between them
'Now you use the same system than before, just imagine to have only one large GroupBox
groupBoxFiles.Location.X = Me.Width / 2 - groupWidth / 2
'Now you have fixed the first GroupBox, you know the distance between the GroupBoxes, and the widths are constant, so it's easy!
groupBoxCustomization.Location.X = groupBoxFiles.Location.X + groupBoxFiles.Width + dist

您可能需要将计算转换为整数,如果是这样,请使用此代码

intValue = CInt(double)

希望这会有所帮助(并且有效......我还没有尝试过):)

于 2013-07-02T13:46:40.417 回答