本文介绍了SplitContainer UserControl中的Groupbox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好,
我的用户控件有问题.
我的用户控件继承自SplitContainer.
现在,我想在两个面板中添加一个组框.
问题是当我这样做时,无法向其中添加控件.
因此,例如,如果将用户控件放在表单上并拖动,则在组框(面板内)上的按钮将被放置在面板上而不是面板上的组框中.这使我的按钮不可见.
Hi all,
I am having a problem with a user control.
My user control inherits from SplitContainer.
Now I want to add a groupbox to both panels.
The problem is that when I do this I can''t add controls to it.
So if I put my user control on a form and I drag, for example, a button on my groupbox (inside a panel) my button will be placed on the panel and not in the groupbox on the panel. This makes my button not visible.
Public Class MySplitter
Inherits SplitContainer
Public m_Groupbox1 As GroupBox
Public Sub New()
MyBase.New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
InitGB
End Sub
Private Sub InitGB()
m_Groupbox1 = New GroupBox
m_Groupbox1.Name = "GroupBox1"
m_Groupbox1.Text = "Hello"
m_Groupbox1.Dock = DockStyle.Fill
Me.Panel1.Controls.Add(m_Groupbox1)
End Sub
关于如何进行这项工作有什么建议吗?
感谢
Any suggestions on how I would make this work?
Thanks
推荐答案
这篇关于SplitContainer UserControl中的Groupbox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!