2012-03-28 73 views
-1

我在Silverlight中做了一个应用程序。在那个应用程序中,我想在运行时使用坐标绘制一个圆。我已经动态地绘制了这个圆圈,但我想要在特定的坐标(X,Y)上画圆。但我不明白。如何使用坐标在silverlight中绘制一个圆圈?

请帮帮我。提前致谢。

回答

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

而且具有在下面的网站看看.....

http://pietschsoft.com/post/2010/06/28/Silverlight-Bing-Maps-Draw-Circle-Around-Latitude-Longitude-Location.aspx

http://www.kunal-chowdhury.com/2011/07/how-to-create-circular-loader-using.html

希望这篇文章可以帮助你解决你的问题......如果是这样,请标注它回答...

+0

我写了相同的代码,因为你给了,但如果我将值0更改为任何其他值,仍然我在相同的位置获得圆。 ellipse.SetValue(Grid.RowProperty,100); ellipse.SetValue(Grid.ColumnProperty,100); – Dany 2012-03-28 07:46:27

+0

我使用了相同的代码......它工作..... – 2012-03-28 08:50:16