gpt4 book ai didi

wpf - 如何在 WPF 中的 XAML 中制作加号?

转载 作者:行者123 更新时间:2023-12-02 04:23:04 26 4
gpt4 key购买 nike

如何使用 Polygon 在 WPF 中制作加号?

<Polygon Points="?,? ?,? ?,? ?,?" Fill="Green"></Polygon>

最佳答案

最简单的方法是使用Path:

 <Path Stretch="Fill" Width="100" Height="100"
Fill="Green"
Data="M4.1561281,2.2702953 L4.8524521,2.2702954 4.8509674,3.963097 5.8969377,3.9630803 5.8969378,5.0916036 4.8524628,5.1061913 4.8524521,6.7843885 4.1561281,6.7843887 4.1559771,5.0877741 3.1116421,5.0916036 3.1116421,3.9630803 4.1556735,3.9654722 4.1561281,2.2702953 z"/>

您可以使用“直接选择”在 Blend 中轻松编辑此路径

多边形示例:

<Viewbox Width="50" Height="50">
<Polygon Name="myPolygon" Fill="Green" ></Polygon>
</Viewbox>

隐藏代码:

myPolygon.Points = new PointCollection()
{
new Point(4.1561279296875,2.27029538154602),
new Point(4.85245227813721,2.27029538154602),
new Point(4.85096740722656,3.9630970954895),
new Point(5.89693784713745,3.96308040618896),
new Point(5.89693784713745,5.09160375595093),
new Point(4.85246276855469,5.10619115829468),
new Point(4.85245227813721,6.78438854217529),
new Point(4.1561279296875,6.78438854217529),
new Point(4.15597724914551,5.0877742767334),
new Point(3.11164212226868,5.09160375595093),
new Point(3.11164212226868,3.96308040618896),
new Point(4.15567350387573,3.96547222137451),
new Point(4.1561279296875,2.27029538154602)
};

关于wpf - 如何在 WPF 中的 XAML 中制作加号?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28915955/

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