DrawingContext.DrawRectangle DrawingContext.DrawRectangle DrawingContext.DrawRectangle Method

Definition

Draws a rectangle.

Overloads

DrawRectangle(Brush, Pen, Rect) DrawRectangle(Brush, Pen, Rect) DrawRectangle(Brush, Pen, Rect)

Draws a rectangle with the specified Brush and Pen. The pen and the brush can be null.

DrawRectangle(Brush, Pen, Rect, AnimationClock) DrawRectangle(Brush, Pen, Rect, AnimationClock) DrawRectangle(Brush, Pen, Rect, AnimationClock)

Draws a rectangle with the specified Brush and Pen and applies the specified animation clocks.

DrawRectangle(Brush, Pen, Rect) DrawRectangle(Brush, Pen, Rect) DrawRectangle(Brush, Pen, Rect)

Draws a rectangle with the specified Brush and Pen. The 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

Parameters

brush
Brush Brush Brush

The brush with which to fill the rectangle. This is optional, and can be null. If the brush is null, no fill is drawn.

pen
Pen Pen Pen

The pen with which to stroke the rectangle. This is optional, and can be null. If the pen is null, no stroke is drawn.

rectangle
Rect Rect Rect

The rectangle to draw.

Remarks

The brush and the pen can both be null. If the brush is null, then no fill is performed. If the pen is null, then no stoke is performed. If both the pen and the brush are null, then the drawing is not visible.

DrawRectangle(Brush, Pen, Rect, AnimationClock) DrawRectangle(Brush, Pen, Rect, AnimationClock) DrawRectangle(Brush, Pen, Rect, AnimationClock)

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

Parameters

brush
Brush Brush Brush

The brush with which to fill the rectangle. This is optional, and can be null. If the brush is null, no fill is drawn.

pen
Pen Pen Pen

The pen with which to stroke the rectangle. This is optional, and can be null. If the pen is null, no stroke is drawn.

rectangle
Rect Rect Rect

The rectangle to draw.

rectangleAnimations
AnimationClock AnimationClock AnimationClock

The clock with which to animate the rectangle's size and dimensions, or null for no animation. This clock must be created from an AnimationTimeline that can animate Rect objects.

Remarks

The brush and the pen can both be null. If the brush is null, then no fill is performed. If the pen is null, then no stoke is performed. If both the pen and the brush are null, then the drawing is not visible.

Applies to