GroupBoxRenderer.DrawGroupBox Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Draws a group box control.
Overloads
DrawGroupBox(Graphics, Rectangle, GroupBoxState) |
Draws a group box control in the specified state and bounds. |
DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState) |
Draws a group box control in the specified state and bounds, with the specified text and font. |
DrawGroupBox(Graphics, Rectangle, String, Font, Color, GroupBoxState) |
Draws a group box control in the specified state and bounds, with the specified text, font, and color. |
DrawGroupBox(Graphics, Rectangle, String, Font, TextFormatFlags, GroupBoxState) |
Draws a group box control in the specified state and bounds, with the specified text, font, and text formatting. |
DrawGroupBox(Graphics, Rectangle, String, Font, Color, TextFormatFlags, GroupBoxState) |
Draws a group box control in the specified state and bounds, with the specified text, font, color, and text formatting. |
DrawGroupBox(Graphics, Rectangle, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
Draws a group box control in the specified state and bounds.
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)
Parameters
- state
- GroupBoxState
One of the GroupBoxState values that specifies the visual state of the group box.
Examples
The following code example uses the DrawGroupBox(Graphics, Rectangle, GroupBoxState) method in a custom control's OnPaint method to draw a group box with a double border. This code example is part of a larger example provided for the GroupBoxRenderer class.
// 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
Remarks
If visual styles are enabled in the operating system and visual styles are applied to the current application, this method will draw the group box with the current visual style. Otherwise, this method will draw the group box with the classic Windows style.
Applies to
DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
Draws a group box control in the specified state and bounds, with the specified text and font.
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)
Parameters
- state
- GroupBoxState
One of the GroupBoxState values that specifies the visual state of the group box.
Examples
The following code example uses the DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState) method in a custom control's OnPaint method to draw a group box with a double border. This code example is part of a larger example provided for the GroupBoxRenderer class.
// 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
Remarks
If visual styles are enabled in the operating system and visual styles are applied to the current application, this method will draw the group box with the current visual style. Otherwise, this method will draw the group box with the classic Windows style.
Applies to
DrawGroupBox(Graphics, Rectangle, String, Font, Color, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
Draws a group box control in the specified state and bounds, with the specified text, font, and color.
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)
Parameters
- state
- GroupBoxState
One of the GroupBoxState values that specifies the visual state of the group box.
Remarks
If visual styles are enabled in the operating system and visual styles are applied to the current application, this method will draw the group box with the current visual style. Otherwise, this method will draw the group box with the classic Windows style.
Applies to
DrawGroupBox(Graphics, Rectangle, String, Font, TextFormatFlags, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
Draws a group box control in the specified state and bounds, with the specified text, font, and text formatting.
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)
Parameters
- flags
- TextFormatFlags
A bitwise combination of the TextFormatFlags values.
- state
- GroupBoxState
One of the GroupBoxState values that specifies the visual state of the group box.
Remarks
If visual styles are enabled in the operating system and visual styles are applied to the current application, this method will draw the group box with the current visual style. Otherwise, this method will draw the group box with the classic Windows style.
Applies to
DrawGroupBox(Graphics, Rectangle, String, Font, Color, TextFormatFlags, GroupBoxState)
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
- Source:
- GroupBoxRenderer.cs
Draws a group box control in the specified state and bounds, with the specified text, font, color, and text formatting.
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)
Parameters
- flags
- TextFormatFlags
A bitwise combination of the TextFormatFlags values.
- state
- GroupBoxState
One of the GroupBoxState values that specifies the visual state of the group box.
Remarks
If visual styles are enabled in the operating system and visual styles are applied to the current application, this method will draw the group box with the current visual style. Otherwise, this method will draw the group box with the classic Windows style.