
private void button1_Click(object sender, EventArgs e)
{
int x =(int)thisnumericUpDown1Value;
Point point = thisdataGridView1Location;
thisdataGridView1Location = new Point(x, pointY);// x y可以根据别的控件的值取得
}
private void button1_Click(object sender, EventArgs e)
{
button2Location = new Point(button2LocationX + 1, button2LocationY);//单击BUtton1时向右移动1像素
}
把int x,int y放在事件外就可以了
public static Int16 x;
public static Int16 y;
form2的load()事件里面写
TextBox1text="x="+form1xtostring()+",y="+form1ytostring();
第二个问题你试试用fm2show();
比如一个
:
Button
btn=new
Button();
btnText="按钮";
btnLoaction=new
Point();//坐标
btnWidth=100;
btnHeight=30;
btnClick+=New
System(记不大清楚了)//添加单击实践
这样就创建了一个按钮
下面如果将按钮加入到Panel
里
名称为pControls
pControlsControlsadd(btn);
这样就把上面的按钮加到Panel里了。
收工
以上就是关于winform如何通过输入坐标改变控件坐标全部的内容,包括:winform如何通过输入坐标改变控件坐标、winform中有两个按钮,如何点击第一个按钮触发事件使第二个按钮可以改变坐标位置比如向右移动,求、C#winform有2个panel,在右边panel获取鼠标的坐标(x,y),如何传递到panel1上d出的窗口form2里面呢等相关内容解答,如果想了解更多相关内容,可以关注我们,你们的支持是我们更新的动力!
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)