且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在WPF中获取用户控件的位置

更新时间:2022-12-26 10:46:27

:
公共表格1()
{
initializecomponent();
}



if you want to set location change:
public form1()
{
initializecomponent();
}

to

public form1( int x, int y)
{
 initializecomponent();
this.location=new point(x,y);
}



但是如果您想更改大小,只需更换:

this.location =新点(x,y);



this.size =新尺寸(x,y);

因此,当您呼叫打开表单时,请像这样:
form1 f1 =新form1(150,150);
f1.show();



but if you want to change the size just replace:

this.location=new point(x,y);

with

this.size=new size(x,y);

so when you call to open form call it like:
form1 f1=new form1(150,150);
f1.show();


到sanforjackass,

谢谢您的回复.
但是:
我没有仅适用于表单的属性位置form.locationchange-
活动吗?

您只了解一半的问题-我想根据显示的用户控件来设置Windows位置

谢谢
To sanforjackass,

Hi thanks for your reply.
But:
I dont have property location for my form only form.locationchange -
event?

U understood only half of the quesiton- i want to set the windows location acoording to a user control displayed

Thanks