移动在运行时创建的控件 [英] moving of controls which was created in run time
本文介绍了移动在运行时创建的控件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在运行时创建了一个面板,并在该面板中根据我的算法创建了许多文本框和许多标签.
现在,我可以找到特定文本框和标签的名称,但无法在运行时移动文本框和标签
请给我解决方案
I had created one panel in run time and in that panel I had created a number of textboxes and a number of labels based on my algorithm.
Right now I am able to find the names of the particular textbox and labels but I am not able to move the text boxes and labels in run time
Please give me the solution
推荐答案
更改控件的Location
属性.
1.如果在面板中创建文本框和标签,则可以直接移动面板而不是移动文本框和标签.由于面板是容器控件.
2.您可以将面板位置"更改为鼠标位置的适配器,例如:
1. If you create the textboxes and the labels in the panel, then you can move the panel directly rather than moving the textboxes and labels. Since the panel is a container control.
2. You can change the Location of panel to adapter to the mouse position, such as:
protected override void OnMouseMove(MouseEventArgs e)
{
this.panel1.Location = new Point(e.X, e.Y);
base.OnMouseMove(e);
}
这篇关于移动在运行时创建的控件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文