为什么WPF PathFigure在某些旋转时没有填充?

时间:2019-04-05 12:45:32

标签: wpf rendering

该箭头应为红色填充,但在RotateTransform的某些角度缺少该填充。它从〜92°消失到〜279°

在我的整个项目中,还出现了只有箭头的一部分被填充的情况。这是WPF渲染错误还是我在这里做错了什么?

  <StackPanel Orientation="Vertical">

    <Slider x:Name="slider"
            Value="180"
            Minimum="0"
            Maximum="360" />

    <Canvas Width="296"
            Height="296">
      <Canvas.Background>
        <DrawingBrush Stretch="Uniform">
          <DrawingBrush.Drawing>
            <DrawingGroup>
              <GeometryDrawing Brush="Red">
                <GeometryDrawing.Pen>
                  <Pen Brush="Lime"
                       Thickness="2" />
                </GeometryDrawing.Pen>
                <GeometryDrawing.Geometry>
                  <PathGeometry>
                    <PathGeometry.Transform>
                      <TransformGroup>
                        <RotateTransform Angle="{Binding ElementName=slider, Path=Value}" />
                      </TransformGroup>
                    </PathGeometry.Transform>
                    <PathGeometry.Figures>
                      <PathFigure IsClosed="True"
                                  StartPoint="100 50">
                        <LineSegment Point="50 87.5" />
                        <LineSegment Point="50 62.5" />
                        <LineSegment Point=" 0 62.5" />
                        <LineSegment Point=" 0 37.5" />
                        <LineSegment Point="50 37.5" />
                        <LineSegment Point="50 12.5" />
                      </PathFigure>
                    </PathGeometry.Figures>
                  </PathGeometry>
                </GeometryDrawing.Geometry>
              </GeometryDrawing>
            </DrawingGroup>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Canvas.Background>
    </Canvas>
  </StackPanel>

1 个答案:

答案 0 :(得分:0)

您只需通过其RenderTransform旋转路径:

disk.systemPartition.initPath = /Users/user/Library/Android/sdk/system-images/android-26/google_apis/x86//system.img

disk.vendorPartition.initPath = /Users/user/Library/Android/sdk/system-images/android-26/google_apis/x86//vendor.img