UIElement.Clip 屬性

定義

取得或設定用來定義UIElement內容的大綱的RectangleGeometry

public:
 property RectangleGeometry ^ Clip { RectangleGeometry ^ get(); void set(RectangleGeometry ^ value); };
RectangleGeometry Clip();

void Clip(RectangleGeometry value);
public RectangleGeometry Clip { get; set; }
var rectangleGeometry = uIElement.clip;
uIElement.clip = rectangleGeometry;
Public Property Clip As RectangleGeometry
<uiElement>
  <uiElement.Clip>
    rectangleGeometry
  </uiElement.Clip>
</uiElement>

屬性值

要用於裁剪區域調整大小的矩形幾何。 預設值為 null , (沒有裁剪) 。

範例

這個範例是簡單的 XAML 標記,使用內嵌 RectangleGeometry 來指定 Clip,以透過屬性語法指定其維度。

<Canvas>
    <Image Source="Images/Water_lilies.jpg" Width="200" Height="150">
        <Image.Clip>
            <RectangleGeometry Rect="100 75 50 50"/>
        </Image.Clip>
    </Image>
</Canvas>

備註

Windows 執行階段 API 中 UIElement.Clip 的裁剪幾何必須是RectangleGeometry。 您無法指定非矩形幾何。

裁剪的區域是幾何的「外部」。 換句話說,如果未) 裁剪 (顯示的內容,就是使用 Fill 繪製矩形的區域,如果幾何是用來做為 Path 的資料,而不是裁剪。 裁剪的區域是落在矩形外的任何區域。 裁剪的區域無法點擊測試。

適用於