TabRenderer.DrawTabItem 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
繪製用來在索引標籤控制項中選取頁面的索引標籤。
多載
DrawTabItem(Graphics, Rectangle, TabItemState) |
在指定的狀態和範圍中繪製索引標籤。 |
DrawTabItem(Graphics, Rectangle, Boolean, TabItemState) |
在指定的狀態和範圍中,繪製具有選擇性焦點矩形的索引標籤。 |
DrawTabItem(Graphics, Rectangle, String, Font, TabItemState) |
在指定的狀態和範圍中,使用指定的文字繪製索引標籤。 |
DrawTabItem(Graphics, Rectangle, Image, Rectangle, Boolean, TabItemState) |
在指定的狀態和範圍中,繪製具有指定影像和選擇性焦點矩形的索引標籤。 |
DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState) |
在指定的狀態和範圍中,繪製具有指定文字和選擇性焦點矩形的索引標籤。 |
DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Boolean, TabItemState) |
在指定的狀態和範圍中,繪製具有指定文字和文字格式以及選擇性焦點矩形的索引標籤。 |
DrawTabItem(Graphics, Rectangle, String, Font, Image, Rectangle, Boolean, TabItemState) |
在指定的狀態和範圍中,繪製具有指定文字和影像以及選擇性焦點矩形的索引標籤。 |
DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, TabItemState) |
在指定的狀態和範圍中,繪製具有指定文字、文字格式和影像以及選擇性焦點矩形的索引標籤。 |
DrawTabItem(Graphics, Rectangle, TabItemState)
在指定的狀態和範圍中繪製索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, state As TabItemState)
參數
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, Boolean, TabItemState)
在指定的狀態和範圍中,繪製具有選擇性焦點矩形的索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, focused As Boolean, state As TabItemState)
參數
- focused
- Boolean
true
表示繪製焦點矩形,否則為 false
。
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, String, Font, TabItemState)
在指定的狀態和範圍中,使用指定的文字繪製索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, state As TabItemState)
參數
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, Image, Rectangle, Boolean, TabItemState)
在指定的狀態和範圍中,繪製具有指定影像和選擇性焦點矩形的索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::Drawing::Image ^ image, System::Drawing::Rectangle imageRectangle, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, image As Image, imageRectangle As Rectangle, focused As Boolean, state As TabItemState)
參數
- focused
- Boolean
true
表示繪製焦點矩形,否則為 false
。
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState)
在指定的狀態和範圍中,繪製具有指定文字和選擇性焦點矩形的索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, focused As Boolean, state As TabItemState)
參數
- focused
- Boolean
true
表示繪製焦點矩形,否則為 false
。
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
範例
下列程式碼範例會 DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState) 使用自訂控制項 OnPaint 方法中的 方法來繪製索引標籤專案。 此程式碼範例是針對 類別提供的較大範例的 TabRenderer 一部分。
// Draw the tab page and the tab items.
protected:
virtual void OnPaint(PaintEventArgs^ e) override
{
__super::OnPaint(e);
if (!TabRenderer::IsSupported)
{
this->Parent->Text = "CustomTabControl Disabled";
return;
}
TabRenderer::DrawTabPage(e->Graphics, tabPageRectangle);
TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle1,
tab1Text, this->Font, tab1Focused, tab1State);
TabRenderer::DrawTabItem(e->Graphics, tabItemRectangle2,
tab2Text, this->Font, tab2Focused, tab2State);
this->Parent->Text = "CustomTabControl Enabled";
}
// Draw the tab page and the tab items.
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
if (!TabRenderer.IsSupported)
{
this.Parent.Text = "CustomTabControl Disabled";
return;
}
TabRenderer.DrawTabPage(e.Graphics, tabPageRectangle);
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle1,
tab1Text, this.Font, tab1Focused, tab1State);
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle2,
tab2Text, this.Font, tab2Focused, tab2State);
this.Parent.Text = "CustomTabControl Enabled";
}
' Draw the tab page and the tab items.
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
MyBase.OnPaint(e)
If Not TabRenderer.IsSupported Then
Me.Parent.Text = "CustomTabControl Disabled"
Return
End If
TabRenderer.DrawTabPage(e.Graphics, tabPageRectangle)
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle1, _
tab1Text, Me.Font, tab1Focused, tab1State)
TabRenderer.DrawTabItem(e.Graphics, tabItemRectangle2, _
tab2Text, Me.Font, tab2Focused, tab2State)
Me.Parent.Text = "CustomTabControl Enabled"
End Sub
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Boolean, TabItemState)
在指定的狀態和範圍中,繪製具有指定文字和文字格式以及選擇性焦點矩形的索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, flags As TextFormatFlags, focused As Boolean, state As TabItemState)
參數
- flags
- TextFormatFlags
TextFormatFlags 值的位元組合。
- focused
- Boolean
true
表示繪製焦點矩形,否則為 false
。
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, String, Font, Image, Rectangle, Boolean, TabItemState)
在指定的狀態和範圍中,繪製具有指定文字和影像以及選擇性焦點矩形的索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Drawing::Image ^ image, System::Drawing::Rectangle imageRectangle, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, image As Image, imageRectangle As Rectangle, focused As Boolean, state As TabItemState)
參數
- focused
- Boolean
true
表示繪製焦點矩形,否則為 false
。
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。
適用於
DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, TabItemState)
在指定的狀態和範圍中,繪製具有指定文字、文字格式和影像以及選擇性焦點矩形的索引標籤。
public:
static void DrawTabItem(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds, System::String ^ tabItemText, System::Drawing::Font ^ font, System::Windows::Forms::TextFormatFlags flags, System::Drawing::Image ^ image, System::Drawing::Rectangle imageRectangle, bool focused, System::Windows::Forms::VisualStyles::TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
public static void DrawTabItem (System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.TextFormatFlags flags, System.Drawing.Image image, System.Drawing.Rectangle imageRectangle, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);
static member DrawTabItem : System.Drawing.Graphics * System.Drawing.Rectangle * string * System.Drawing.Font * System.Windows.Forms.TextFormatFlags * System.Drawing.Image * System.Drawing.Rectangle * bool * System.Windows.Forms.VisualStyles.TabItemState -> unit
Public Shared Sub DrawTabItem (g As Graphics, bounds As Rectangle, tabItemText As String, font As Font, flags As TextFormatFlags, image As Image, imageRectangle As Rectangle, focused As Boolean, state As TabItemState)
參數
- flags
- TextFormatFlags
TextFormatFlags 值的位元組合。
- focused
- Boolean
true
表示繪製焦點矩形,否則為 false
。
- state
- TabItemState
TabItemState 的其中一個值,指定索引標籤的可見狀態。
例外狀況
備註
呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true
回 。