![](/img/trans.png)
[英]How do I make an image property in a winforms user control available in the properties window
[英]Changing the Dock property in a Winforms user control
我正在尝试创建一个按钮,该按钮将隐藏我停靠在用户控件中心的面板。
我的表格布局如下:
toolStrip1 (docked to top)
topPanel (docked to fill)
bottomPanel (docked to bottom)
我有以下代码:
Private Sub ShowHideTopPanel()
If topPanel.Visible Then
topPanel.Visible = False
bottomPanel.Dock = DockStyle.Fill
Else
topPanel.Visible = True
bottomPanel.Dock = DockStyle.Bottom
End If
End Sub
这在一定程度上有效。 但是,当bottomPanel
设置为 Fill 时,它似乎会填充整个控件,而不仅仅是toolStrip1
。 谁能告诉我为什么会发生这种情况,以及如何纠正它?
您的控件的 z-index 导致了这种行为。 尝试使用[Control].BringToFront()
和[Control].SendToBack()
方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.