DrawingContext.DrawRectangle 方法

定義

繪製矩形。Draws a rectangle.

多載

DrawRectangle(Brush, Pen, Rect)

利用指定的 BrushPen 繪製矩形。Draws a rectangle with the specified Brush and Pen. 畫筆和筆刷可以是 nullThe pen and the brush can be null.

DrawRectangle(Brush, Pen, Rect, AnimationClock)

利用指定的 BrushPen 繪製矩形,然後套用指定的動畫時鐘。Draws a rectangle with the specified Brush and Pen and applies the specified animation clocks.

DrawRectangle(Brush, Pen, Rect)

利用指定的 BrushPen 繪製矩形。Draws a rectangle with the specified Brush and Pen. 畫筆和筆刷可以是 nullThe pen and the brush can be null.

public:
 abstract void DrawRectangle(System::Windows::Media::Brush ^ brush, System::Windows::Media::Pen ^ pen, System::Windows::Rect rectangle);
public abstract void DrawRectangle (System.Windows.Media.Brush brush, System.Windows.Media.Pen pen, System.Windows.Rect rectangle);
abstract member DrawRectangle : System.Windows.Media.Brush * System.Windows.Media.Pen * System.Windows.Rect -> unit
Public MustOverride Sub DrawRectangle (brush As Brush, pen As Pen, rectangle As Rect)

參數

brush
Brush

用來填滿矩形的筆刷。The brush with which to fill the rectangle. 這是選擇性,而且可為 nullThis is optional, and can be null. 如果筆刷為 null,則不會繪製任何填滿。If the brush is null, no fill is drawn.

pen
Pen

用來將矩形描邊的畫筆。The pen with which to stroke the rectangle. 這是選擇性,而且可為 nullThis is optional, and can be null. 如果畫筆位於 null,則不會繪製任何筆觸。If the pen is null, no stroke is drawn.

rectangle
Rect

要繪製的矩形。The rectangle to draw.

備註

筆刷和畫筆可以同時 nullThe brush and the pen can both be null. 如果筆刷 null,則不會執行任何填滿。If the brush is null, then no fill is performed. 如果畫筆 null,則不會執行任何筆觸。If the pen is null, then no stroke is performed. 如果畫筆和筆刷都 null,則不會顯示繪圖。If both the pen and the brush are null, then the drawing is not visible.

DrawRectangle(Brush, Pen, Rect, AnimationClock)

利用指定的 BrushPen 繪製矩形,然後套用指定的動畫時鐘。Draws a rectangle with the specified Brush and Pen and applies the specified animation clocks.

public:
 abstract void DrawRectangle(System::Windows::Media::Brush ^ brush, System::Windows::Media::Pen ^ pen, System::Windows::Rect rectangle, System::Windows::Media::Animation::AnimationClock ^ rectangleAnimations);
public abstract void DrawRectangle (System.Windows.Media.Brush brush, System.Windows.Media.Pen pen, System.Windows.Rect rectangle, System.Windows.Media.Animation.AnimationClock rectangleAnimations);
abstract member DrawRectangle : System.Windows.Media.Brush * System.Windows.Media.Pen * System.Windows.Rect * System.Windows.Media.Animation.AnimationClock -> unit
Public MustOverride Sub DrawRectangle (brush As Brush, pen As Pen, rectangle As Rect, rectangleAnimations As AnimationClock)

參數

brush
Brush

用來填滿矩形的筆刷。The brush with which to fill the rectangle. 這是選擇性,而且可為 nullThis is optional, and can be null. 如果筆刷為 null,則不會繪製任何填滿。If the brush is null, no fill is drawn.

pen
Pen

用來將矩形描邊的畫筆。The pen with which to stroke the rectangle. 這是選擇性,而且可為 nullThis is optional, and can be null. 如果畫筆位於 null,則不會繪製任何筆觸。If the pen is null, no stroke is drawn.

rectangle
Rect

要繪製的矩形。The rectangle to draw.

rectangleAnimations
AnimationClock

用來建立矩形大小和維度動畫的時鐘,不使用動畫則為 nullThe clock with which to animate the rectangle's size and dimensions, or null for no animation. 這個時鐘必須從可以將 AnimationTimeline 物件顯示為動畫的 Rect 建立。This clock must be created from an AnimationTimeline that can animate Rect objects.

備註

筆刷和畫筆可以同時 nullThe brush and the pen can both be null. 如果筆刷 null,則不會執行任何填滿。If the brush is null, then no fill is performed. 如果 null畫筆,則不會執行任何搧風。If the pen is null, then no stoke is performed. 如果畫筆和筆刷都 null,則不會顯示繪圖。If both the pen and the brush are null, then the drawing is not visible.

適用於