Redigera

Dela via


DrawingContext.DrawRectangle Method

Definition

Draws a rectangle.

Overloads

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)

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

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
Public MustOverride Sub DrawRectangle (brush As Brush, pen As Pen, rectangle As Rect)

Parameters

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

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

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 stroke is performed. If both the pen and the brush are null, then the drawing is not visible.

Applies to

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
Public MustOverride Sub DrawRectangle (brush As Brush, pen As Pen, rectangle As Rect, rectangleAnimations As AnimationClock)

Parameters

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

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

The rectangle to draw.

rectangleAnimations
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