使用GetValue和SetValue来设置属性

使用GetValue和SetValue来设置属性

public yufa2()

{

InitializeComponent();//利用GetValue和SetValue

double left = 400;

double top = 30;

double radius = 10;

string width;

string height;

//设置矩形的位置

rect_MyRectangle.SetValue(Canvas.LeftProperty, left);

rect_MyRectangle.SetValue(Canvas.TopProperty, top);

//设置矩形的圆角度

rect_MyRectangle.SetValue(Rectangle.RadiusXProperty, radius);

rect_MyRectangle.SetValue(Rectangle.RadiusYProperty, radius);

//获取矩形的宽和高

width = rect_MyRectangle.GetValue(Rectangle.WidthProperty).ToString();

height = rect_MyRectangle.GetValue(Rectangle.HeightProperty).ToString();

//输出文本

txb_MyText2.Text = "矩形的宽是:" + width + " 高是:" + height;

txb_MyText2.SetValue(Canvas.LeftProperty, 400.00);

}

运行如图:

相关手记

365bet取款要多久 瞎子光速摸眼教程

瞎子光速摸眼教程

10-27 👁️ 6435
365bet取款要多久 韩国疫情简报(2022年9月19日)
365bet取款要多久 杜比音效

杜比音效

09-25 👁️ 9225
365bet取款要多久 教育基金(发展基金)|兴华基金
365彩票最新版app下载 微信可省近一半流量?关闭这几个功能
beat365英超欧冠比分 疇的意思,疇的解释,疇的拼音,疇的部首,疇的笔顺