Export (0) Print
Expand All
Expand Minimize

CaptionButton Enumeration

Specifies the type of caption button to display.

[Visual Basic]
<Serializable>
Public Enum CaptionButton
[C#]
[Serializable]
public enum CaptionButton
[C++]
[Serializable]
__value public enum CaptionButton
[JScript]
public
   Serializable
enum CaptionButton

Remarks

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.

Members

Member name Description
Close A Close button.
Help A Help button.
Maximize A Maximize button.
Minimize A Minimize button.
Restore A Restore button.

Example

[Visual Basic, C#] The following code example demonstrates the use the CaptionButton enumeration. To run this example paste the following code in a form containing a Button named Button1 and associate the event-handling method contained in the example with the button's paint event. The form should import the System.Windows.Forms and System.Drawing namespaces.

[Visual Basic] 
' Handle the Button1 object's Paint Event to create a CaptionButton.
Private Sub Button1_Paint(ByVal sender As Object, _
    ByVal e As PaintEventArgs) Handles Button1.Paint

    ' 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)
End Sub

[C#] 
// 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);
}

[C++, JScript] No example is available for C++ or JScript. To view a Visual Basic or C# example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Windows.Forms

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

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

See Also

System.Windows.Forms Namespace | DrawCaptionButton

Show:
© 2014 Microsoft