System.Windows.Forms.ButtonRenderer.DrawButton Method

Draws a button control in the specified state and bounds; with the specified text, text formatting, and image; and with an optional focus rectangle.

Syntax

public static void DrawButton (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string buttonText, System.Drawing.Font font, TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageBounds, bool focused, System.Windows.Forms.VisualStyles.PushButtonState state)

Parameters

g
The System.Drawing.Graphics used to draw the button.
bounds
The System.Drawing.Rectangle that specifies the bounds of the button.
buttonText
The string to draw on the button.
font
The System.Drawing.Font to apply to buttonText.
flags
A bitwise combination of the System.Windows.Forms.TextFormatFlags values to apply to buttonText.
image
The System.Drawing.Image to draw on the button.
imageBounds
The System.Drawing.Rectangle that represents the dimensions of image.
focused
true to draw a focus rectangle on the button; otherwise, false.
state
One of the System.Windows.Forms.VisualStyles.PushButtonState values that specifies the visual state of the button.

Remarks

If visual styles are enabled in the operating system and visual styles are applied to the current application, this method will draw the button with the current visual style. Otherwise, it will draw the button with the classic Windows style.

Requirements

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
Assembly Versions: 2.0.0.0
Since: .NET 2.0