|
可显示/隐藏左边控件的Splitter(3) End If Next If Not targetctrl Is Nothing Then Dim tt As ToolTip = CType(lbl.Tag, ToolTip) If lbl.Text = "3" Then lbl.Text = 4 tt.SetToolTip(lbl, "显示左边的的控件") targetctrl.Visible = False Else lbl.Text = 3 tt.SetToolTip(lbl, "隐藏左边的的控件") targetctrl.Visible = True End If End If End Sub Private Shared Sub splitter_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Dim sl As Splitter = CType(sender, Splitter) Dim lbl As Label = sl.Controls(0) lbl.Location = New Point(-3.5, sl.Height / 2 - lbl.Height) End Sub End Class
使用时,在窗体的初始化代码中加入如下所示的红色代码即可: Public Sub New() MyBase.New() '该调用是 Windows 窗体设计器所必需的。 InitializeComponent() '在 InitializeComponent() 调用之后添加任何初始化
|