RT~
创建几个lable,然后每个lable之间画线连接,如何实现拖拽lable的同时,直线也跟着联动~~~急急急求解,lable的拖拽移动问题我已经解决了,关键是怎么让线跟着联动~~~
lable拖拽代码如下是:
lable1.MouseDown += new MouseEventHandler(Switch_MouseDown);
lable1.MouseMove += new MouseEventHandler(Switch_MouseMove);
private Point m_lastPoint;
private Point m_lastMPoint;
private void lable1_MouseDown(object sender, MouseEventArgs e)
{
m_lastMPoint = Control.MousePosition;
m_lastPoint = (sender as Label).Location;
}
private void lable1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
((Label)sender).Location = new Point(m_lastPoint.X + Control.MousePosition.X - m_lastMPoint.X, m_lastPoint.Y + Control.MousePosition.Y - m_lastMPoint.Y);
}
}