Click to Rate and Give Feedback
MSDN
MSDN Library
.NET Development
.NET Framework 3.5
 CaptionButton Enumeration

  Switch on low bandwidth view
This page is specific to
Microsoft Visual Studio 2008/.NET Framework 3.5

Other versions are also available for the following:
.NET Framework Class Library
CaptionButton Enumeration

Specifies the type of caption button to display.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)
Visual Basic (Declaration)
Public Enumeration CaptionButton
Visual Basic (Usage)
Dim instance As CaptionButton
C#
public enum CaptionButton
Visual C++
public enum class CaptionButton
JScript
public enum CaptionButton
Member nameDescription
Close A Close button.
Help A Help button.
Maximize A Maximize button.
Minimize A Minimize button.
Restore A 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.

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);
    }

Visual C++
// Handle the Button1 object's Paint Event to create a CaptionButton.
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 );
}

Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98

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

.NET Framework

Supported in: 3.5, 3.0, 2.0, 1.1, 1.0
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2009 Microsoft Corporation. All rights reserved. Terms of Use  |  Trademarks  |  Privacy Statement
Page view tracker