尝试通过在其上放置Panel
并在RichTextBox
顶部放置Panel
来设计表单。有没有资源管理器显示RichTextBox
由Panel
拥有,而不是Form
拥有?
我需要知道谁拥有每个组件。
答案 0 :(得分:1)
右键单击RichTextBox,然后在打开的上下文菜单中(在中间菜单中),假设名称为richTextBox1,panel1,form1,菜单项为:
选择“ richTextBox1”
选择“ panel1”
选择“ form1”
这表明richtextbox1包含在panel1中,... 如果richtextbox位于表单内,则菜单项将如下所示:
选择“ richTextBox1”
选择“ form1”
在运行时,您可以简单地执行以下操作:
Control c = RichTextBox1;
while(c.Parent!=null)
{
MessageBox.Show(c.Name);
c = c.Parent;
}