UserControl锚点属性与FlowLayoutPanel一起使用时 [英] UserControl Anchor Property When used with FlowLayoutPanel
问题描述
你好朋友
我正在将UserControl添加到FlowLayoutPanel并尝试设置Anchor属性,但似乎我缺少了一些东西,需要帮助.
I am adding a UserControl to a FlowLayoutPanel and trying to set the Anchor Property but seems like I am missing something and need help.
将vl_oNewUserControl设置为新的UserControl1
Dim vl_oNewUserControl As New UserControl1
vl_oNewUserControl.Width = FlowLayoutPanel1.Width
vl_oNewUserControl.Width = FlowLayoutPanel1.Width
vl_oNewUserControl.Parent = FlowLayoutPanel1
vl_oNewUserControl.Parent = FlowLayoutPanel1
vl_oNewUserControl.Anchor = AnchorStyles.Right或AnchorStyles.Top
vl_oNewUserControl.Anchor = AnchorStyles.Right Or AnchorStyles.Top
FlowLayoutPanel1.Controls.Add(vl_oNewUserControl)
FlowLayoutPanel1.Controls.Add(vl_oNewUserControl)
已经在Designer中设置了FlowLayout的Anchor属性,并且可以很好地调整其大小,但是由于调整了父窗体的大小,因此在重新调整FlowLayout的大小时,无法调整Flowlayout中的用户控件的大小.
The FlowLayout's Anchor Property has been set in Designer and works good and gets resized, however the usercontrol(s) in the flowlayout does not gets resized when the FlowLayout is resized due to resizing of Parent Form.
帮助.
推荐答案
我认为这可以追溯到您昨天的原始问题,即有关设置用于放置这些控件的布局面板的问题.
I assume this goes back to your original question yesterday about setting up a flowlayout panel to host these controls.
您是否在某种UI布局中拥有垂直的用户控件列表?
Is this some sort of UI layout where you have a vertical list of user controls?
赞:
用户控制实例1
用户控制实例2
用户控制实例3
如果是这样,那么最好将表格布局放在单列多行中.这可能使您更接近实际要做的事情.如果您能确定这是您想要的,我可以为您提供一些示例代码.
If so, then you might be better off going with the table layout in single column, multiple row. This might get you closer to what you are actually looking to do. If you can clarify if this what you want, I can get you some example code.
这篇关于UserControl锚点属性与FlowLayoutPanel一起使用时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!