Pen.MiterLimit 屬性

定義

取得或設定限制,將斜接面長度比例限制為這個畫筆之 Thickness 的一半。

public:
 property double MiterLimit { double get(); void set(double value); };
public double MiterLimit { get; set; }
member this.MiterLimit : double with get, set
Public Property MiterLimit As Double

屬性值

Double

限制,將斜接面長度比例限制為畫筆之 Thickness 的一半。 這個值一律是大於或等於 1 的正數。 預設值為 10.0。

範例

下列範例示範如何使用 MiterLimit 屬性來限制兩條線段所建立的邊角大小。

<Page 
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
  <StackPanel Margin="20">

    <Canvas Margin="100"  Width="100" Height="100">
      <Canvas.Background>
        <DrawingBrush>
          <DrawingBrush.Drawing>
            <GeometryDrawing>
              <GeometryDrawing.Geometry>
                <PathGeometry>
                  <PathGeometry.Figures>
                    <PathFigureCollection>
                      <PathFigure StartPoint="100,50">
                        <PathFigure.Segments>
                          <PathSegmentCollection>
                            <LineSegment Point="200,70" />
                            <LineSegment Point="100,60" />
                          </PathSegmentCollection>
                        </PathFigure.Segments>
                      </PathFigure>
                    </PathFigureCollection>
                  </PathGeometry.Figures>
                </PathGeometry>
              </GeometryDrawing.Geometry>
              <GeometryDrawing.Pen>

                <!-- The MiterLimit is set to a value of 0 so the corner formed
                     by where the two line segments join is cut or blunted. A larger 
                     value would allow for the corner to extend out even beyond 
                     the thickness of the line. -->
                <Pen Brush="Blue" Thickness="4" MiterLimit="0"  />
              </GeometryDrawing.Pen>
            </GeometryDrawing>
          </DrawingBrush.Drawing>
        </DrawingBrush>
      </Canvas.Background>
    </Canvas>

  </StackPanel>

</Page>

下圖顯示此程式碼範例所產生的內容。

顯示 MiterLimit 範例。已切割邊角。

備註

Miter 是一種接合方式,是兩個要聯結以形成邊角的兩個表面的斜面所建立的接合。 當兩條線段以尖角開會時,斜線可能會超出觸碰路徑的線條粗細。

相依性屬性資訊

識別碼欄位 MiterLimitProperty
中繼資料屬性設定為 true

適用於

另請參閱