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)
在指定的狀態和範圍中繪製群組方塊控制項。
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 的其中一個值,指定群組方塊的可見狀態。
範例
下列程式碼範例會在 DrawGroupBox(Graphics, Rectangle, GroupBoxState) 自訂控制項的 OnPaint 方法中使用 方法,以雙框線繪製群組框。 此程式碼範例是提供給 類別之較大範例的 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)
在指定的狀態和範圍中,使用指定的文字和字型繪製群組方塊控制項。
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 的其中一個值,指定群組方塊的可見狀態。
範例
下列程式碼範例會在 DrawGroupBox(Graphics, Rectangle, String, Font, GroupBoxState) 自訂控制項的 OnPaint 方法中使用 方法,以雙框線繪製群組框。 此程式碼範例是提供給 類別之較大範例的 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)
在指定的狀態和範圍中,使用指定的文字、字型和色彩繪製群組方塊控制項。
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)
在指定的狀態和範圍中,使用指定的文字、字型和文字格式繪製群組方塊控制項。
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)
在指定的狀態和範圍中,使用指定的文字、字型、色彩和文字格式繪製群組方塊控制項。
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 樣式繪製群組方塊。