GroupBoxRenderer.DrawGroupBox 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
绘制分组框控件。
重载
DrawGroupBox(Graphics, Rectangle, GroupBoxState) |
绘制具有指定状态和边界的分组框控件。 |
DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState) |
绘制具有指定的状态和边界以及指定的文本和字体的分组框控件。 |
DrawGroupBox(Graphics, Rectangle, String, Font, Color, GroupBoxState) |
绘制具有指定的状态和边界以及指定的文本、字体和颜色的分组框控件。 |
DrawGroupBox(Graphics, Rectangle, String, Font, TextFormatFlags, GroupBoxState) |
绘制具有指定的状态和边界以及指定的文本、字体和文本格式的分组框控件。 |
DrawGroupBox(Graphics, Rectangle, String, Font, Color, TextFormatFlags, GroupBoxState) |
绘制具有指定的状态和边界以及指定的文本、字体、颜色和文本格式的分组框控件。 |
DrawGroupBox(Graphics, Rectangle, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
绘制具有指定状态和边界的分组框控件。
public:
static void DrawGroupBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.GroupBoxState state);
static member DrawGroupBox : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.GroupBoxState -> unit
Public Shared Sub DrawGroupBox (g As Graphics, bounds As Rectangle, state As GroupBoxState)
参数
- state
- GroupBoxState
指定分组框可视状态的 GroupBoxState 值之一。
示例
下面的代码示例在自定义控件的 OnPaint 方法中使用 DrawGroupBox(Graphics, Rectangle, GroupBoxState) 方法绘制具有双边框的分组框。 此代码示例是为 GroupBoxRenderer 类提供的一个更大示例的一部分。
// Draw the group box in the current state.
protected:
virtual void OnPaint(PaintEventArgs^ e) override
{
__super::OnPaint(e);
GroupBoxRenderer::DrawGroupBox(e->Graphics, ClientRectangle,
this->Text, this->Font, state);
// Draw an additional inner border if visual styles are enabled.
if (Application::RenderWithVisualStyles)
{
GroupBoxRenderer::DrawGroupBox(e->Graphics, innerRectangle,
state);
}
}
// Draw the group box in the current state.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
GroupBoxRenderer.DrawGroupBox(e.Graphics, ClientRectangle,
this.Text, this.Font, state);
// Draw an additional inner border if visual styles are enabled.
if (Application.RenderWithVisualStyles)
{
GroupBoxRenderer.DrawGroupBox(e.Graphics, innerRectangle, state);
}
}
' Draw the group box in the current state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
GroupBoxRenderer.DrawGroupBox(e.Graphics, ClientRectangle, Me.Text, Me.Font, state)
' Draw an additional inner border if visual styles are enabled.
If Application.RenderWithVisualStyles Then
GroupBoxRenderer.DrawGroupBox(e.Graphics, innerRectangle, state)
End If
End Sub
注解
如果在操作系统中启用了视觉样式,并且视觉样式应用于当前应用程序,则此方法将使用当前视觉样式绘制分组框。 否则,此方法将使用经典 Windows 样式绘制分组框。
适用于
DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
绘制具有指定的状态和边界以及指定的文本和字体的分组框控件。
public:
static void DrawGroupBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ groupBoxText, System::Drawing::Font ^ font, System::Windows::Forms::VisualStyles::GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string groupBoxText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? groupBoxText, System.Drawing.Font? font, System.Windows.Forms.VisualStyles.GroupBoxState state);
static member DrawGroupBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.VisualStyles.GroupBoxState -> unit
Public Shared Sub DrawGroupBox (g As Graphics, bounds As Rectangle, groupBoxText As String, font As Font, state As GroupBoxState)
参数
- state
- GroupBoxState
指定分组框可视状态的 GroupBoxState 值之一。
示例
下面的代码示例在自定义控件的 OnPaint 方法中使用 DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState) 方法绘制具有双边框的分组框。 此代码示例是为 GroupBoxRenderer 类提供的一个更大示例的一部分。
// Draw the group box in the current state.
protected:
virtual void OnPaint(PaintEventArgs^ e) override
{
__super::OnPaint(e);
GroupBoxRenderer::DrawGroupBox(e->Graphics, ClientRectangle,
this->Text, this->Font, state);
// Draw an additional inner border if visual styles are enabled.
if (Application::RenderWithVisualStyles)
{
GroupBoxRenderer::DrawGroupBox(e->Graphics, innerRectangle,
state);
}
}
// Draw the group box in the current state.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
GroupBoxRenderer.DrawGroupBox(e.Graphics, ClientRectangle,
this.Text, this.Font, state);
// Draw an additional inner border if visual styles are enabled.
if (Application.RenderWithVisualStyles)
{
GroupBoxRenderer.DrawGroupBox(e.Graphics, innerRectangle, state);
}
}
' Draw the group box in the current state.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
GroupBoxRenderer.DrawGroupBox(e.Graphics, ClientRectangle, Me.Text, Me.Font, state)
' Draw an additional inner border if visual styles are enabled.
If Application.RenderWithVisualStyles Then
GroupBoxRenderer.DrawGroupBox(e.Graphics, innerRectangle, state)
End If
End Sub
注解
如果在操作系统中启用了视觉样式,并且视觉样式应用于当前应用程序,则此方法将使用当前视觉样式绘制分组框。 否则,此方法将使用经典 Windows 样式绘制分组框。
适用于
DrawGroupBox(Graphics, Rectangle, String, Font, Color, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
绘制具有指定的状态和边界以及指定的文本、字体和颜色的分组框控件。
public:
static void DrawGroupBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ groupBoxText, System::Drawing::Font ^ font, System::Drawing::Color textColor, System::Windows::Forms::VisualStyles::GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string groupBoxText, System.Drawing.Font font, System.Drawing.Color textColor, System.Windows.Forms.VisualStyles.GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? groupBoxText, System.Drawing.Font? font, System.Drawing.Color textColor, System.Windows.Forms.VisualStyles.GroupBoxState state);
static member DrawGroupBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Color * System.Windows.Forms.VisualStyles.GroupBoxState -> unit
Public Shared Sub DrawGroupBox (g As Graphics, bounds As Rectangle, groupBoxText As String, font As Font, textColor As Color, state As GroupBoxState)
参数
- state
- GroupBoxState
指定分组框可视状态的 GroupBoxState 值之一。
注解
如果在操作系统中启用了视觉样式,并且视觉样式应用于当前应用程序,则此方法将使用当前视觉样式绘制分组框。 否则,此方法将使用经典 Windows 样式绘制分组框。
适用于
DrawGroupBox(Graphics, Rectangle, String, Font, TextFormatFlags, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
绘制具有指定的状态和边界以及指定的文本、字体和文本格式的分组框控件。
public:
static void DrawGroupBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ groupBoxText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Windows::Forms::VisualStyles::GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string groupBoxText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? groupBoxText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.GroupBoxState state);
static member DrawGroupBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Windows.Forms.VisualStyles.GroupBoxState -> unit
Public Shared Sub DrawGroupBox (g As Graphics, bounds As Rectangle, groupBoxText As String, font As Font, flags As TextFormatFlags, state As GroupBoxState)
参数
- flags
- TextFormatFlags
TextFormatFlags 值的按位组合。
- state
- GroupBoxState
指定分组框可视状态的 GroupBoxState 值之一。
注解
如果在操作系统中启用了视觉样式,并且视觉样式应用于当前应用程序,则此方法将使用当前视觉样式绘制分组框。 否则,此方法将使用经典 Windows 样式绘制分组框。
适用于
DrawGroupBox(Graphics, Rectangle, String, Font, Color, TextFormatFlags, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
绘制具有指定的状态和边界以及指定的文本、字体、颜色和文本格式的分组框控件。
public:
static void DrawGroupBox(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ groupBoxText, System::Drawing::Font ^ font, System::Drawing::Color textColor, System::Windows::Forms::TextFormatFlags flags, System::Windows::Forms::VisualStyles::GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string groupBoxText, System.Drawing.Font font, System.Drawing.Color textColor, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.GroupBoxState state);
public static void DrawGroupBox (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? groupBoxText, System.Drawing.Font? font, System.Drawing.Color textColor, System.Windows.Forms.TextFormatFlags flags, System.Windows.Forms.VisualStyles.GroupBoxState state);
static member DrawGroupBox : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Color * System.Windows.Forms.TextFormatFlags * System.Windows.Forms.VisualStyles.GroupBoxState -> unit
Public Shared Sub DrawGroupBox (g As Graphics, bounds As Rectangle, groupBoxText As String, font As Font, textColor As Color, flags As TextFormatFlags, state As GroupBoxState)
参数
- flags
- TextFormatFlags
TextFormatFlags 值的按位组合。
- state
- GroupBoxState
指定分组框可视状态的 GroupBoxState 值之一。
注解
如果在操作系统中启用了视觉样式,并且视觉样式应用于当前应用程序,则此方法将使用当前视觉样式绘制分组框。 否则,此方法将使用经典 Windows 样式绘制分组框。