Suppose I have PathGeometry
, consisting of lines, like this (the rectangle == panel, for example Grid
): I want to fill them to the bottom of the panel, like this: The quick and not very good solution I see is to create additional curve with 2 additional points in the bottom and use it for filling.
假设我有PathGeometry,包括这样的行(矩形==面板,例如Grid):我想将它们填充到面板的底部,如下所示:我看到的快速而不是很好的解决方案是创建附加曲线底部有2个附加点,用于填充。
Is there some better way to solve the task? Something like this (pseudocode):
有没有更好的方法来解决这个任务?像这样的东西(伪代码):
<Path Data=... FillStyle = "ToTheBottom" Fill="Blue"/>
1 个解决方案
#1
6
There is no standard way of doing this; there is no Fill like this defined in WPF.
没有标准的方法可以做到这一点;在WPF中没有像这样定义的Fill。
You could put two path geometries on top of each other. The bottom one would have a stroke thickness of 0 and has 2 extra points (those on the lower edge of the rectangle)
您可以将两个路径几何图形放在一起。底部的笔触厚度为0,并且有2个额外的点(矩形的下边缘)
The second one the top would simply be the geometry you have now.
第二个顶部就是你现在拥有的几何形状。
If you need to draw a lot of these you might create a custom control that does this for you.
如果你需要绘制很多这些,你可以创建一个自定义控件来为你完成。
#1
6
There is no standard way of doing this; there is no Fill like this defined in WPF.
没有标准的方法可以做到这一点;在WPF中没有像这样定义的Fill。
You could put two path geometries on top of each other. The bottom one would have a stroke thickness of 0 and has 2 extra points (those on the lower edge of the rectangle)
您可以将两个路径几何图形放在一起。底部的笔触厚度为0,并且有2个额外的点(矩形的下边缘)
The second one the top would simply be the geometry you have now.
第二个顶部就是你现在拥有的几何形状。
If you need to draw a lot of these you might create a custom control that does this for you.
如果你需要绘制很多这些,你可以创建一个自定义控件来为你完成。