开发者

Combining Shapes, LineGeometry missing a stroke property

开发者_高级运维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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜