I have a button and another control placed in a usercontrol
I want to pop out the control below the button to the topp of all other controls when the bitton in the usercontrol is clicked
您可以举办任何类型的Control
in a ToolStripControlHost https://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripcontrolhost(v=vs.110).aspx然后将其添加到项目工具栏下拉菜单 https://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripdropdown(v=vs.110).aspx然后显示下拉菜单:
Dim dropdown As ToolStripDropDown = New ToolStripDropDown()
Dim c As UserControl1 = New UserControl1()
Dim host As ToolStripControlHost = New ToolStripControlHost(c)
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles Button2.Click
If (dropdown.Items.Count = 0) Then
host.BackColor = Color.White
host.Margin = New Padding(2)
c.MinimumSize = New Size(120, 100)
dropdown.Padding = New Padding(0)
dropdown.Margin = New Padding(0)
dropdown.Items.Add(host)
End If
dropdown.Show(Button2, 0, Button1.Height)
End Sub
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)