如何从半径和内角度在Silverlight中绘制弧线

问题描述:

在Silverlight 3项目中,我必须以编程方式绘制弧线,并且我有圆弧的半径和弧线的内角。你能否指导我参阅一些相关文章。如何从半径和内角度在Silverlight中绘制弧线

感谢您的期待!

哈里斯

这似乎是在建筑圆弧的好文章动态http://codingbandit.com/Blog/blog/dynamically-creating-path-data-in-silverlight-2/

要计算使用下列公式的点。

x = a + r * cos(θ) 
y = b + r * sin(θ) 

* r is the radius of the circle 
* (a,b) is the center of the circle 
* (x,y) is the point on the circumference 
* θ is the angle in degrees 
* radian = degree * π/180 

你有半径r和角度θ。这应该建立点系列。

你会想看看在Silverlight,特别在ArcSegments部分路径。

ArcSegment Documentation

MSDN Path Geometry Samples

With Expression Blend 4。你可以使用Arc

实施例:

<UserControl 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
    xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing" 
    x:Class="SilverlightApplication1.MainPage" 
    Width="640" Height="480"> 

    <Grid x:Name="LayoutRoot" Background="White"> 
     <Canvas Margin="101,88,118,125"> 
      <ed:Arc ArcThickness="0" ArcThicknessUnit="Pixel" EndAngle="90" Fill="#FFF4F4F5" Height="60" Canvas.Left="101" Stretch="None" Stroke="Black" StartAngle="0" Canvas.Top="63" UseLayoutRounding="False" Width="57"/> 
     </Canvas> 
    </Grid> 
</UserControl>