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

发布于 2024-08-22 08:25:45 字数 94 浏览 9 评论 0原文

在 silverlight 3 项目中,我必须以编程方式绘制圆弧,并且我有圆的半径和圆弧的内角。您能指导我一些相关文章吗?

感谢期待!

哈里斯

In a silverlight 3 project I have to draw an arc programatically and I have radius of circle and inner angle of the arc. Could you please direct me to some related articles.

Thanks in anticipation!

Haris

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

后知后觉 2024-08-29 08:25:45

这似乎是一篇关于动态构建弧的好文章 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 和角度 θ。这应该建立点系列。

This seems to be a good article on building arcs dynamically http://codingbandit.com/Blog/blog/dynamically-creating-path-data-in-silverlight-2/

To calculate the points the following formula is used.

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

you have the radius of the circle r and also the angle θ. That should build up the point series.

前事休说 2024-08-29 08:25:45

您将需要查看 silverlight 中的路径,特别是 ArcSegments 部分。

ArcSegment 文档

MSDN 路径几何示例

You're going to want to look at Paths in silverlight and specifically at the ArcSegments section.

ArcSegment Documentation

MSDN Path Geometry Samples

2024-08-29 08:25:45

使用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>

With Expression Blend 4. You could use Arc.

Example:

<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>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文