如何使用坐标在silverlight中绘制圆?
我正在申请Silverlight。在该应用程序中,我希望在运行时使用坐标绘制一个圆。我已经动态地画了这个圆,但是我想在特定的坐标(X,Y)上画这个圆。但我不明白 请帮帮我。提前谢谢如何使用坐标在silverlight中绘制圆?,silverlight,graphics,runtime,geometry,Silverlight,Graphics,Runtime,Geometry,我正在申请Silverlight。在该应用程序中,我希望在运行时使用坐标绘制一个圆。我已经动态地画了这个圆,但是我想在特定的坐标(X,Y)上画这个圆。但我不明白 请帮帮我。提前谢谢 Ellipse ellipse = new Ellipse() { Width = 150, Height = 150, Stroke = new SolidColorBrush(Colors.Black), Horizont
Ellipse ellipse = new Ellipse() { Width = 150, Height = 150, Stroke = new SolidColorBrush(Colors.Black),
HorizontalAlignment = HorizontalAlignment.Center,
VerticalAlignment = VerticalAlignment.Center
};
ellipse.SetValue(Grid.RowProperty, 0);
ellipse.SetValue(Grid.ColumnProperty, 0);
this.LayoutRoot.Children.Add(ellipse);
TextBlock textblock = new TextBlock() { Text = "Hello", HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center };
textblock.SetValue(Grid.ColumnProperty, 0);
textblock.SetValue(Grid.RowProperty, 0);
this.LayoutRoot.Children.Add(textblock);
并在下面的网站上查看
希望这篇文章能帮助你解决你的问题。。。如果是,请将其标记为回答…要实现此目的,请使用
canvas
容器并在椭圆上设置canvas.Left
和canvas.Top
属性。有关更多信息,请参阅(以及相应的Canvas.Top文章)。我编写的代码与u给出的代码相同,但如果我将值0更改为任何其他值,我仍然会得到相同位置的圆。椭圆.SetValue(Grid.RowProperty,100);ellipse.SetValue(Grid.ColumnProperty,100);