gpt4 book ai didi

c# - 画一个点

转载 作者:行者123 更新时间:2023-12-01 18:51:10 25 4
gpt4 key购买 nike

一定是一个简单的问题,但我找不到或弄清楚自己的解决方案。

如何在wpf中绘制单个点?

在 winforms 中我做了类似的事情

graphics.DrawLine(pen, x, y, x+1, y+1);

但是在wpf中xy变成了double(或者好吧,实际上我从来没有在winforms中使用过float ),然后有一个 Pen 和设备相关/独立单元,因此添加 +1 看起来不再好。如何在 wpf 中绘制单点?

最佳答案

您可以在 WPF 中通过多种方式绘制点。一种方法是使用 Ellipse class ...尝试这个 XAML:

<Ellipse Width="1" Height="1" Stroke="Black" HorizontalAlignment="Center" 
VerticalAlignment="Center" />

或者,您可以尝试使用 DrawingContext.DrawEllipse Method表达你的观点:

YourDrawingContext.DrawEllipse(YourBrush, YourPen, YourPointPosition, radiusX, radius);

关于c# - 画一个点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25381948/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com