在我编写的程序中,用户可以向表单中添加控件,移动它们并在伪设计模式下设置一些属性。当他们按下按钮切换到“数据模式”时,我希望能够锁定所有这些控件到一个位置。我该怎么做呢?我想循环遍历所有控件并使用“Lock Property”,但我注意到它没有在智能感知中显示。
谢谢!
谢谢!
private void enableControlsMove()
{
foreach (Control theControl in panel1.Controls)
{
Console.WriteLine(theControl.Name);
theControl.MouseDown += new MouseEventHandler(theControl_MouseDown);
theControl.MouseUp += new MouseEventHandler(theControl_MouseUp);
theControl.MouseMove += new MouseEventHandler(theControl_MouseMove);
}
}
private void disableControlsMove()
{
foreach (Control theControl in panel1.Controls)
{
Console.WriteLine(theControl.Name);
theControl.MouseDown -= theControl_MouseDown;
theControl.MouseUp -= theControl_MouseUp;
theControl.MouseMove -= theControl_MouseMove;
}
}