WPF中的控制位置 [英] control position in wpf

查看:82
本文介绍了WPF中的控制位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用此代码以win形式设置控件位置:

i use this code to set the control location in win form :

TextBox1.Location = new Point (100,100);


在c#wpf中,此代码等效于什么?


what is this code equivalent in c# wpf ?

推荐答案

对于位置,WPF使用Margin.
因此,请使用以下代码设置位置.

button1.Margin = new厚度(10,10,0,0);

有关对齐和边距的更多信息:
http://msdn.microsoft.com/en-us/library/ms751709.aspx [ ^ ]
For Location, WPF uses Margin.
So use the following code to set the location.

button1.Margin = new Thickness(10, 10, 0, 0);

For more info on alignment and margins:
http://msdn.microsoft.com/en-us/library/ms751709.aspx[^]


这篇关于WPF中的控制位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆