CaptionButton 枚举

指定要显示的标题按钮的类型。

**命名空间:**System.Windows.Forms
**程序集:**System.Windows.Forms(在 system.windows.forms.dll 中)

语法

声明
Public Enumeration CaptionButton
用法
Dim instance As CaptionButton
public enum CaptionButton
public enum class CaptionButton
public enum CaptionButton
public enum CaptionButton

成员

  成员名称 说明
Close “关于”按钮。 
Help “帮助”按钮。 
Maximize “最大化”按钮。 
Minimize “最小化”按钮。 
Restore “还原”按钮。 

备注

ControlPaint.DrawCaptionButton 使用此枚举。

标题按钮是系统按钮,通常出现在窗体标题栏的最右边。

示例

下面的代码示例演示如何使用 ControlPaint.DrawCaptionButton 方法和 CaptionButton 枚举。要运行该代码,请将以下代码粘贴到一个包含名为 Button1 的按钮的窗体中。该窗体应导入 System.Windows.Forms 和 System.Drawing 命名空间。确保该按钮的 Paint 事件与此示例中的事件处理方法相关联。

' 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
// 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.
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

.NET Framework 并不是对每个平台的所有版本都提供支持。有关受支持版本的列表,请参见系统要求

版本信息

.NET Framework

受以下版本支持:2.0、1.1、1.0

请参见

参考

System.Windows.Forms 命名空间
DrawCaptionButton