组合形状、LineGeometry 缺少笔划属性

发布于 2024-12-02 21:12:50 字数 248 浏览 2 评论 0原文

有什么方法可以将两种形状组合成一种形状,而不是几何形状。我知道我可以使用线几何形状通过 GeometryGroup 来完成此操作,并且两条线将是复合形状。但是,线条几何图形没有自己的笔划属性,因此它们使用形状的笔划,因此不能不同。有什么想法吗?

换句话说,我想从形状中派生,其中线条几何图形具有笔划属性,所以我在想是否可以从形状中派生,其中线条几何图形有自己的形状笔划属性。我正在考虑将形状传递给派生类的参数,然后获取它们的几何图形,但几何图形仍然会使用相同的笔画。

Is there any way that you can combine two shapes into one, not geometries. I know I can do this with GeometryGroup using line geometries and the two lines will be a composite shape. However, line geometries don't have their own stroke properties, so they use the stroke of the Shape, thus cannot be different. Any ideas?

In other words, I want to derive from shape, where line geometries have a stroke property, so I am thinking if I can derive from shape, where line geometries have their own shape stroke property. I was thinking of passing to shapes to the argument of the derived class, and then get their geometries, but the geometries would still use the same stroke.

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

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

发布评论

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

评论(1

猛虎独行 2024-12-09 21:12:50

您可能想查看绘图而不是形状。 DrawingGroup 具有我在上面查看的属性。然后,您可以在 ImageDrawing 中托管 DrawnigGroup。这样做的缺点是它没有形状所做的任何可能性,例如鼠标事件(您可以使用视觉命中测试和计时器来实现这些事件)。另一种方法是将 DrawingGroup 托管在 DrawingVisual 内。与 ImageDrawing 不同,DrawingVisual 提供了一些基本的机会,例如单击事件,但我对此不确定。我的问题的问题在于我将几何图形与绘图和其他图形对象混淆了。几何图形仅提供形状的路径,仅此而已。它们就像如何绘制某物的说明。您需要一个图形对象来使用此几何体来渲染形状,即将其与画笔和笔划(对于绘图子类,例如 GeometryDrawing 来说是笔)组合起来。视觉也做了类似的事情。最后,形状与视觉效果和绘图类似,只是它们实现了 FrameworkElement 的所有功能。

You might want to look into Drawings instead of shapes. DrawingGroup has the property that I was looking above. You can then host a DrawnigGroup inside an ImageDrawing. The draw back to this is that it doesn't any of the possibilities that shapes do, such as mouse events (you could possibly implement these with using the visual hit test and a timer). Another approach would be to host the DrawingGroup inside a DrawingVisual. As opposed to ImageDrawing, DrawingVisual provides some basic opportunities, such as click events but I am not sure on this. The problem with my question wast that I was confusing geometries with drawings and the other graphics objects. Geometries only provide a path for a shape, nothing more. They are like instructions of how something is to be drawn. You need a graphics object to use this geometry to render the shape, that is to combine it with a brush and a stroke (pen in case of the Drawing subclasses such as GeometryDrawing). Visual do a similar thing. At last shapes are similar to Visuals and Drawings except that they implement all of the functionality of a FrameworkElement.

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