Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/silverlight/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用坐标在silverlight中绘制圆?_Silverlight_Graphics_Runtime_Geometry - Fatal编程技术网

如何使用坐标在silverlight中绘制圆?

如何使用坐标在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

我正在申请Silverlight。在该应用程序中,我希望在运行时使用坐标绘制一个圆。我已经动态地画了这个圆,但是我想在特定的坐标(X,Y)上画这个圆。但我不明白

请帮帮我。提前谢谢

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);