Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

ControlPaint.DrawCaptionButton Method (Graphics, Rectangle, CaptionButton, ButtonState)

Draws the specified caption button control in the specified state, on the specified graphics surface, and within the specified bounds.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

public static void DrawCaptionButton(
	Graphics graphics,
	Rectangle rectangle,
	CaptionButton button,
	ButtonState state
)

Parameters

graphics
Type: System.Drawing.Graphics

The Graphics to draw on.

rectangle
Type: System.Drawing.Rectangle

The Rectangle that represents the dimensions of the caption button.

button
Type: System.Windows.Forms.CaptionButton

One of the CaptionButton values that specifies the type of caption button to draw.

state
Type: System.Windows.Forms.ButtonState

A bitwise combination of the ButtonState values that specifies the state to draw the button in.

The following code example demonstrates the use of the ControlPaint.DrawCaptionButton method and the CaptionButton enumeration. To run this example, paste the following code in a form containing a Button named Button1. The form should import the System.Windows.Forms and System.Drawing namespaces. Ensure the button's Paint event is associated with the event handler in this example.

	// Handle the Button1 object's Paint Event to create a CaptionButton. 
	private void Button1_Paint(object sender, PaintEventArgs e)
	{

		// Draw a CaptionButton control using the ClientRectangle  
		// property of Button1. Make the button a Help button  
		// with a normal state.
		ControlPaint.DrawCaptionButton(e.Graphics, Button1.ClientRectangle,
			CaptionButton.Help, ButtonState.Normal);
	}
the use the ControlPaint.DrawCaptionButton method. To run this example paste the following code in a form containing a Button named Button1.
  The form should import the System.Windows.Forms and System.Drawing namespaces.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1
Show:
© 2015 Microsoft