ImageBrush 類別

定義

使用影像繪製區域。Paints an area with an image.

public ref class ImageBrush sealed : System::Windows::Media::TileBrush
public sealed class ImageBrush : System.Windows.Media.TileBrush
type ImageBrush = class
    inherit TileBrush
Public NotInheritable Class ImageBrush
Inherits TileBrush
繼承

備註

ImageBrush是的一種類型 TileBrush ,可將其內容定義為影像,這是由其 ImageSource 屬性所指定。An ImageBrush is a type of TileBrush that defines its content as an image, which is specified by its ImageSource property. 您可以控制影像的伸展、對齊和並排顯示方式,讓您能夠產生模式和其他效果。You can control how the image is stretched, aligned, and tiled, enabling you to produce patterns and other effects. 下列影像顯示一些可透過來達成的效果 ImageBrushThe following images show some effects that can be achieved with an ImageBrush.

ImageBrush 輸出範例ImageBrush output examples
ImageBrush 可以繪製圖形、控制項、文字等An ImageBrush can paint shapes, controls, text, and more

如前所述,會 ImageBrush 使用繪製區域 ImageSourceAs mentioned, an ImageBrush paints an area with an ImageSource. 與搭配使用的最常見類型 ImageSource ImageBrushBitmapImage ,它會描述點陣圖圖形。The most common type of ImageSource to use with an ImageBrush is a BitmapImage, which describes a bitmap graphic. 您可以使用 DrawingImage 來繪製使用 Drawing 物件,但改用是較簡單的方式 DrawingBrushYou can use a DrawingImage to paint using a Drawing object, but it is simpler to use a DrawingBrush instead. 如需物件的詳細資訊 ImageSource ,請參閱 影像處理總覽For more information about ImageSource objects, see Imaging Overview.

如需功能的詳細資訊 ImageBrush ,請參閱 使用影像、繪圖和視覺效果繪製For more information about ImageBrush features, see Painting with Images, Drawings, and Visuals overview.

Freezable 功能Freezable Features

因為 ImageBrush 類別繼承自 Freezable ,所以 ImageBrush 物件會取得數個特殊功能,其中包括下列各項:可以宣告為 資源,在多個物件之間共用,使其成為唯讀以改善效能、複製並使執行緒安全。Because the ImageBrush class inherits from Freezable, ImageBrush objects gain several special features, which include the following: they can be declared as resources, shared among multiple objects, made read-only to improve performance, cloned, and made thread safe. 如需物件所提供之功能的詳細資訊 Freezable ,請參閱可 凍結物件總覽For more information about the features provided by Freezable objects, see Freezable Objects Overview.

建構函式

ImageBrush()

使用無內容的方式,初始化 ImageBrush 類別的新執行個體。Initializes a new instance of the ImageBrush class with no content.

ImageBrush(ImageSource)

初始化 ImageBrush 類別的新執行個體,其使用指定的影像繪製區域。Initializes a new instance of the ImageBrush class that paints an area with the specified image.

欄位

ImageSourceProperty

識別 ImageSource 相依性屬性。Identifies the ImageSource dependency property.

屬性

AlignmentX

取得或設定 TileBrush 基底拼貼中內容的水平對齊方式。Gets or sets the horizontal alignment of content in the TileBrush base tile.

(繼承來源 TileBrush)
AlignmentY

取得或設定 TileBrush 基底磚中內容的垂直對齊方式。Gets or sets the vertical alignment of content in the TileBrush base tile.

(繼承來源 TileBrush)
CanFreeze

取得值,指出是否可以將物件設為不可修改。Gets a value that indicates whether the object can be made unmodifiable.

(繼承來源 Freezable)
DependencyObjectType

取得包裝此執行個體之 CLRCLR 型別的 DependencyObjectTypeGets the DependencyObjectType that wraps the CLRCLR type of this instance.

(繼承來源 DependencyObject)
Dispatcher

取得與這個 Dispatcher 關聯的 DispatcherObjectGets the Dispatcher this DispatcherObject is associated with.

(繼承來源 DispatcherObject)
HasAnimatedProperties

取得值,這個值表示是否有一個或多個 AnimationClock 物件與這個物件的任何一個相依性屬性相關聯。Gets a value that indicates whether one or more AnimationClock objects is associated with any of this object's dependency properties.

(繼承來源 Animatable)
ImageSource

取得或設定這個 ImageBrush 顯示的影像。Gets or sets the image displayed by this ImageBrush.

IsFrozen

取得值,該值表示物件目前是否可修改。Gets a value that indicates whether the object is currently modifiable.

(繼承來源 Freezable)
IsSealed

取得值,這個值表示此執行個體目前是否已密封 (唯讀)。Gets a value that indicates whether this instance is currently sealed (read-only).

(繼承來源 DependencyObject)
Opacity

取得或設定 Brush 的不透明度。Gets or sets the degree of opacity of a Brush.

(繼承來源 Brush)
RelativeTransform

取得或設定使用相對座標套用到筆刷的轉換。Gets or sets the transformation that is applied to the brush using relative coordinates.

(繼承來源 Brush)
Stretch

取得或設定值,指定如何自動縮放這個 TileBrush 的內容以填滿其拼貼。Gets or sets a value that specifies how the content of this TileBrush stretches to fit its tiles.

(繼承來源 TileBrush)
TileMode

取得或設定值,這個值指定如果基底磚小於輸出區域,TileBrush 要如何填滿您所繪製的區域。Gets or sets a value that specifies how a TileBrush fills the area that you are painting if the base tile is smaller than the output area.

(繼承來源 TileBrush)
Transform

取得或設定套用到筆刷的轉換。Gets or sets the transformation that is applied to the brush. 在已經對應及定位筆刷輸出之後,套用這個轉換。This transformation is applied after the brush's output has been mapped and positioned.

(繼承來源 Brush)
Viewbox

取得或設定 TileBrush 並排顯示內容的位置和維度。Gets or sets the position and dimensions of the content in a TileBrush tile.

(繼承來源 TileBrush)
ViewboxUnits

取得或設定值,指定 Viewbox 值是相對於 TileBrush 內容之周框方塊的值,還是絕對值。Gets or sets a value that specifies whether the Viewbox value is relative to the bounding box of the TileBrush contents or whether the value is absolute.

(繼承來源 TileBrush)
Viewport

取得或設定 TileBrush 之基底磚的位置和維度。Gets or sets the position and dimensions of the base tile for a TileBrush.

(繼承來源 TileBrush)
ViewportUnits

取得或設定 BrushMappingMode 列舉,指定 Viewport 的值是否相對於輸出區域的大小,而此值表示 TileBrush 基底磚的大小和位置。Gets or sets a BrushMappingMode enumeration that specifies whether the value of the Viewport, which indicates the size and position of the TileBrush base tile, is relative to the size of the output area.

(繼承來源 TileBrush)

方法

ApplyAnimationClock(DependencyProperty, AnimationClock)

AnimationClock 套用至指定的 DependencyPropertyApplies an AnimationClock to the specified DependencyProperty. 如果屬性已有動畫效果,即使用 SnapshotAndReplace 遞移式行為。If the property is already animated, the SnapshotAndReplace handoff behavior is used.

(繼承來源 Animatable)
ApplyAnimationClock(DependencyProperty, AnimationClock, HandoffBehavior)

AnimationClock 套用至指定的 DependencyPropertyApplies an AnimationClock to the specified DependencyProperty. 如果已建立屬性的動畫,則會使用指定的 HandoffBehaviorIf the property is already animated, the specified HandoffBehavior is used.

(繼承來源 Animatable)
BeginAnimation(DependencyProperty, AnimationTimeline)

將動畫套用至指定的 DependencyPropertyApplies an animation to the specified DependencyProperty. 呈現下一個畫面格後,就會啟動動畫。The animation is started when the next frame is rendered. 如果指定的屬性已有動畫效果,即使用 SnapshotAndReplace 遞移式行為。If the specified property is already animated, the SnapshotAndReplace handoff behavior is used.

(繼承來源 Animatable)
BeginAnimation(DependencyProperty, AnimationTimeline, HandoffBehavior)

將動畫套用至指定的 DependencyPropertyApplies an animation to the specified DependencyProperty. 呈現下一個畫面格後,就會啟動動畫。The animation is started when the next frame is rendered. 如果已建立指定之屬性的動畫,則會使用指定的 HandoffBehaviorIf the specified property is already animated, the specified HandoffBehavior is used.

(繼承來源 Animatable)
CheckAccess()

判斷呼叫的執行是否可以存取這個 DispatcherObjectDetermines whether the calling thread has access to this DispatcherObject.

(繼承來源 DispatcherObject)
ClearValue(DependencyProperty)

清除屬性的區域數值。Clears the local value of a property. 要清除的屬性是由 DependencyProperty 識別項所指定。The property to be cleared is specified by a DependencyProperty identifier.

(繼承來源 DependencyObject)
ClearValue(DependencyPropertyKey)

清除唯讀屬性的區域數值。Clears the local value of a read-only property. 要清除的屬性是由 DependencyPropertyKey 所指定。The property to be cleared is specified by a DependencyPropertyKey.

(繼承來源 DependencyObject)
Clone()

建立這個 ImageBrush 的可修改複製品,深層複製這個物件的值。Creates a modifiable clone of this ImageBrush, making deep copies of this object's values.

CloneCore(Freezable)

使用基底 (非動畫) 屬性值,將執行個體設為指定 Freezable 的複製品 (深層複製)。Makes the instance a clone (deep copy) of the specified Freezable using base (non-animated) property values.

(繼承來源 Freezable)
CloneCurrentValue()

建立這個 ImageBrush 物件的可修改複製品,製作這個物件目前值的深層複本。Creates a modifiable clone of this ImageBrush object, making deep copies of this object's current values.

CloneCurrentValueCore(Freezable)

使用目前的屬性值,讓執行個體成為指定之 Freezable 的可修改複本 (深層複本)。Makes the instance a modifiable clone (deep copy) of the specified Freezable using current property values.

(繼承來源 Freezable)
CoerceValue(DependencyProperty)

強制轉型所指定相依性屬性的值。Coerces the value of the specified dependency property. 完成方式是叫用存在於呼叫 DependencyObject 之相依性屬性的屬性中繼資料中所指定的任何 CoerceValueCallback 函式。This is accomplished by invoking any CoerceValueCallback function specified in property metadata for the dependency property as it exists on the calling DependencyObject.

(繼承來源 DependencyObject)
CreateInstance()

初始化 Freezable 類別的新執行個體。Initializes a new instance of the Freezable class.

(繼承來源 Freezable)
CreateInstanceCore()

在衍生類別中實作時,建立 Freezable 衍生類別的新執行個體。When implemented in a derived class, creates a new instance of the Freezable derived class.

(繼承來源 Freezable)
Equals(Object)

判斷提供的 DependencyObject 和目前的 DependencyObject 是否相等。Determines whether a provided DependencyObject is equivalent to the current DependencyObject.

(繼承來源 DependencyObject)
Freeze()

將目前的物件設為不可修改,並將其 IsFrozen 屬性設定為 trueMakes the current object unmodifiable and sets its IsFrozen property to true.

(繼承來源 Freezable)
FreezeCore(Boolean)

將這個 Animatable 物件設定為不可修改,或決定是否可以將它設定為不可修改。Makes this Animatable object unmodifiable or determines whether it can be made unmodifiable.

(繼承來源 Animatable)
GetAnimationBaseValue(DependencyProperty)

傳回指定之 DependencyProperty 的非動畫實值。Returns the non-animated value of the specified DependencyProperty.

(繼承來源 Animatable)
GetAsFrozen()

使用基底 (非動畫) 屬性值,建立 Freezable 的凍結複本。Creates a frozen copy of the Freezable, using base (non-animated) property values. 因為複本已凍結,所以會以傳址方式複製任何凍結子物件。Because the copy is frozen, any frozen sub-objects are copied by reference.

(繼承來源 Freezable)
GetAsFrozenCore(Freezable)

使用基底 (非動畫) 屬性值,將執行個體設為指定 Freezable 的凍結複本。Makes the instance a frozen clone of the specified Freezable using base (non-animated) property values.

(繼承來源 Freezable)
GetContentBounds(Rect)

取得 TileBrush 內容目前的界限。Obtains the current bounds of the TileBrush content.

(繼承來源 TileBrush)
GetCurrentValueAsFrozen()

使用目前屬性值,建立 Freezable 的凍結複本。Creates a frozen copy of the Freezable using current property values. 因為複本已凍結,所以會以傳址方式複製任何凍結子物件。Because the copy is frozen, any frozen sub-objects are copied by reference.

(繼承來源 Freezable)
GetCurrentValueAsFrozenCore(Freezable)

將目前執行個體設為所指定 Freezable 的凍結複本。Makes the current instance a frozen clone of the specified Freezable. 如果物件具有動畫相依性屬性,則會複製其目前的動畫值。If the object has animated dependency properties, their current animated values are copied.

(繼承來源 Freezable)
GetHashCode()

取得這個 DependencyObject 的雜湊碼。Gets a hash code for this DependencyObject.

(繼承來源 DependencyObject)
GetLocalValueEnumerator()

建立特定的列舉值,以判斷哪些相依性屬性在此 DependencyObject 上具有本機設定的值。Creates a specialized enumerator for determining which dependency properties have locally set values on this DependencyObject.

(繼承來源 DependencyObject)
GetType()

取得目前執行個體的 TypeGets the Type of the current instance.

(繼承來源 Object)
GetValue(DependencyProperty)

傳回 DependencyObject 的這個執行個體上之相依性屬性的目前有效值。Returns the current effective value of a dependency property on this instance of a DependencyObject.

(繼承來源 DependencyObject)
InvalidateProperty(DependencyProperty)

重新評估指定相依性屬性的有效值。Re-evaluates the effective value for the specified dependency property.

(繼承來源 DependencyObject)
MemberwiseClone()

建立目前 Object 的淺層複製。Creates a shallow copy of the current Object.

(繼承來源 Object)
OnChanged()

目前的 Freezable 物件遭到修改時進行呼叫。Called when the current Freezable object is modified.

(繼承來源 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject)

確定已為剛剛設定的 DependencyObjectType 資料成員,建立適當的內容指標。Ensures that appropriate context pointers are established for a DependencyObjectType data member that has just been set.

(繼承來源 Freezable)
OnFreezablePropertyChanged(DependencyObject, DependencyObject, DependencyProperty)

這個成員支援 Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) 基礎結構,但是您不可以從程式碼直接使用它。This member supports the Windows Presentation Foundation (WPF)Windows Presentation Foundation (WPF) infrastructure and is not intended to be used directly from your code.

(繼承來源 Freezable)
OnPropertyChanged(DependencyPropertyChangedEventArgs)

覆寫 OnPropertyChanged(DependencyPropertyChangedEventArgs)DependencyObject 實作也可以叫用任何 Changed 處理常式,以回應類型 Freezable 的變更相依性屬性。Overrides the DependencyObject implementation of OnPropertyChanged(DependencyPropertyChangedEventArgs) to also invoke any Changed handlers in response to a changing dependency property of type Freezable.

(繼承來源 Freezable)
ReadLocalValue(DependencyProperty)

傳回相依性屬性的區域值 (如果存在)。Returns the local value of a dependency property, if it exists.

(繼承來源 DependencyObject)
ReadPreamble()

確定 Freezable 是從有效的執行緒進行存取。Ensures that the Freezable is being accessed from a valid thread. 如果 API 會讀取非相依性屬性的資料成員,則 Freezable 的繼承者必須在該 API 的開頭呼叫這個方法。Inheritors of Freezable must call this method at the beginning of any API that reads data members that are not dependency properties.

(繼承來源 Freezable)
SetCurrentValue(DependencyProperty, Object)

設定相依性屬性的值,而不需要變更其值來源。Sets the value of a dependency property without changing its value source.

(繼承來源 DependencyObject)
SetValue(DependencyProperty, Object)

設定相依性屬性的區域值 (由相依性屬性的識別碼所指定)。Sets the local value of a dependency property, specified by its dependency property identifier.

(繼承來源 DependencyObject)
SetValue(DependencyPropertyKey, Object)

設定唯讀相依性屬性的區域數值 (由相依性屬性的 DependencyPropertyKey 識別項所指定)。Sets the local value of a read-only dependency property, specified by the DependencyPropertyKey identifier of the dependency property.

(繼承來源 DependencyObject)
ShouldSerializeProperty(DependencyProperty)

傳回值,這個值表示序列化程序是否應該序列化所提供相依性屬性的值。Returns a value that indicates whether serialization processes should serialize the value for the provided dependency property.

(繼承來源 DependencyObject)
ToString()

傳回這個 Brush 的字串表示。Return string representation of this Brush.

(繼承來源 Brush)
ToString(IFormatProvider)

根據指定的文化特性特定格式資訊,建立這個物件的字串表示。Creates a string representation of this object based on the specified culture-specific formatting information.

(繼承來源 Brush)
VerifyAccess()

請強制執行可以存取這個 DispatcherObject 的呼叫執行緒。Enforces that the calling thread has access to this DispatcherObject.

(繼承來源 DispatcherObject)
WritePostscript()

引發 FreezableChanged 事件,並叫用其 OnChanged() 方法。Raises the Changed event for the Freezable and invokes its OnChanged() method. 在任何 API 修改未以相依性屬性儲存的類別成員之後,衍生自 Freezable 的類別應該在 API 的結尾呼叫這個方法。Classes that derive from Freezable should call this method at the end of any API that modifies class members that are not stored as dependency properties.

(繼承來源 Freezable)
WritePreamble()

確認 Freezable 未凍結,而且是從有效的執行緒內容進行存取。Verifies that the Freezable is not frozen and that it is being accessed from a valid threading context. 在任何 API 將資料寫入至非相依性屬性的資料成員之前,Freezable 繼承者應該在 API 的開頭呼叫這個方法。Freezable inheritors should call this method at the beginning of any API that writes to data members that are not dependency properties.

(繼承來源 Freezable)

事件

Changed

發生於 Freezable 或所含的物件遭到修改時。Occurs when the Freezable or an object it contains is modified.

(繼承來源 Freezable)

明確介面實作

IFormattable.ToString(String, IFormatProvider)

使用指定的格式,格式化目前執行個體的值。Formats the value of the current instance using the specified format.

(繼承來源 Brush)

適用於

另請參閱