[英]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.