Export (0) Print
Expand All
Expand Minimize

CaptionButton Enumeration

Specifies the type of caption button to display.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public enum CaptionButton
public enum CaptionButton
public enum CaptionButton

 Member nameDescription
CloseA Close button. 
HelpA Help button. 
MaximizeA Maximize button. 
MinimizeA Minimize button. 
RestoreA Restore button. 

This enumeration is used by ControlPaint.DrawCaptionButton.

Caption buttons are the system buttons usually found on the rightmost side of a form's title bar.

The following code example demonstrates the use 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-handling method 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);
}

// 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.get_Graphics(), 
        button1.get_ClientRectangle(), CaptionButton.Help, 
        ButtonState.Normal);
} //button1_Paint

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft