[英]Move a control to a splitcontainer runtime
I have a custom control (a textbox) that is slow to replicate. 我有一个自定义控件(文本框),复制速度很慢。 I have have code that adds a new split container to the current form when the user clicks the button.
我有一些代码,当用户单击按钮时,会将新的拆分容器添加到当前表单中。 Is there any way that I can move my existing control to the sub panels in the split container at run-time or would I have to make a new instance in the panel?
有什么方法可以在运行时将现有控件移到拆分容器中的子面板上,还是必须在面板中创建一个新实例? Any help is appreciated.
任何帮助表示赞赏。 Thanks!!
谢谢!!
you can add the TextBox
to your SplitContainer
like this: 您可以像这样将
TextBox
添加到您的SplitContainer
:
Assuming the TextBox name is txt1
, SplitContainer's name is spl1
and spl1
has a panel called panel1
假设TextBox名称为
txt1
,SplitContainer的名称为spl1
并且spl1
有一个名为panel1
的面板
spl1.Panel1.Controls.Add(txt1);
txt1.Location=new Point(10,10);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.