【发布时间】:2019-06-22 05:00:15
【问题描述】:
我正在尝试使用用户提供的值在画布中绘制多边形。给定 .xaml 中的默认值,渲染效果很好。尝试从 .cpp 设置 Polygon Points 属性的值时出现了我的问题。我是 UWP 的超级新手,我想我可以将 Points 设置为等于 PointCollection,但这似乎不起作用。任何帮助都会很棒
Canvas 和 Polygon 在 .xaml 中创建的位置
<Canvas x:Name="tCan" Margin="396,48,88,146">
<Polygon x:Name="triangle" Stroke="Black"/>
</Canvas>
将 PointCollection 传递给 .cpp 中的“多边形三角形”
By = 100 + a;
Cy = ((a * a) + (c * c) - (b * b)) / (2 * a);
Cx = sqrt((c * c - (Cy * Cy)));
PointCollection points;
points.Append(Point(100, 100));
points.Append(Point(100, By));
points.Append(Point(Cx, Cy));
triangle->Points = points;
最后一行抛出
"Windows::UI::Xaml::Shapes::Polygon::Points::set" cannot be called with the given argument list
argument types are: (Windows::UI::Xaml::Media::PointCollection)
object type is: Windows::UI::Xaml::Shapes::Polygon ^
【问题讨论】:
标签: c++ xaml canvas uwp polygon