winform中如何获取控件在窗体上位置?

2024-12-21 14:07:21
推荐回答(3个)
回答1:

控件名称.Location

横坐标:控件名称.Location.X
纵坐标:控件名称.Location.Y

回答2:

private void pan_Drowing_MouseClick(object sender, MouseEventArgs e)
{
int a,b;
a = e.X;
b = e.Y;
}

回答3:

"this.button1.Top="+ this.button1.Top.ToString() + ";this.button1.Left=" + this.button1.Left.ToString();