一个圆及其内部半径为 56 的直线

发布于 2024-12-19 16:39:38 字数 76 浏览 2 评论 0原文

如何在圆内画线,线仅在圆内可见,我需要控制线角度。假设有一个圆,并在其中画了一条带有天使 56 的线。如何在 C# WPF 中执行此操作。

How to draw line inside circle, line will be visible only inside circle and I need to have control on line angel. Let say one circle and line inside it with angel 56. How to do this in C# WPF.

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

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

发布评论

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

评论(3

故人的歌 2024-12-26 16:39:38

只需将一个Ellipse 和一个Line 放入Panel 中,让它们在彼此之上绘制(例如网格),然后根据需要调整参数。

<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
    <Grid.LayoutTransform>
        <RotateTransform  Angle="56" CenterX="28" CenterY="28"/>
    </Grid.LayoutTransform>
    <Ellipse Height="56" Width="56" Stroke="Red" StrokeThickness="2" />
    <Line X1="1" X2="55" Y1="28" Y2="28" Stroke="Red" StrokeThickness="2" />
</Grid>

示例

Just put an Ellipse and a Line in a Panel that lets them draw on top of each other (such as a Grid), and adjust the parameters to whatever you want.

<Grid HorizontalAlignment="Center" VerticalAlignment="Center">
    <Grid.LayoutTransform>
        <RotateTransform  Angle="56" CenterX="28" CenterY="28"/>
    </Grid.LayoutTransform>
    <Ellipse Height="56" Width="56" Stroke="Red" StrokeThickness="2" />
    <Line X1="1" X2="55" Y1="28" Y2="28" Stroke="Red" StrokeThickness="2" />
</Grid>

Example

只有影子陪我不离不弃 2024-12-26 16:39:38

如果您想在 XAML 中执行此操作,请像这样执行:

 <Line X1="1" X2="55" Y1="28" Y2="28" Stroke="Red" StrokeThickness="2"  >
        <Line.LayoutTransform>
            <RotateTransform  Angle="56" CenterX="50" CenterY="50"/>
        </Line.LayoutTransform>
 </Line>

If you want to do it in XAML, do it like this:

 <Line X1="1" X2="55" Y1="28" Y2="28" Stroke="Red" StrokeThickness="2"  >
        <Line.LayoutTransform>
            <RotateTransform  Angle="56" CenterX="50" CenterY="50"/>
        </Line.LayoutTransform>
 </Line>
我恋#小黄人 2024-12-26 16:39:38

如果您仔细阅读了相应的概述,您应该能够管理:几何 & 形状

If you read through the respective overviews you should be able to manage: Geometry & Shapes

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