TabRenderer.DrawTabItem 方法

定義

繪製用來在索引標籤控制項中選取頁面的索引標籤。

多載

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

tabItemText
String

在索引標籤中繪製的 String

font
Font

要套用至 tabItemTextFont

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

image
Image

在索引標籤中繪製的 Image

imageRectangle
Rectangle

指定 image 繫結的 Rectangle

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

tabItemText
String

在索引標籤中繪製的 String

font
Font

要套用至 tabItemTextFont

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

tabItemText
String

在索引標籤中繪製的 String

font
Font

要套用至 tabItemTextFont

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

tabItemText
String

在索引標籤中繪製的 String

font
Font

要套用至 tabItemTextFont

image
Image

在索引標籤中繪製的 Image

imageRectangle
Rectangle

指定 image 繫結的 Rectangle

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)

參數

g
Graphics

繪製索引標籤所用的 Graphics

bounds
Rectangle

指定索引標籤繫結的 Rectangle

tabItemText
String

在索引標籤中繪製的 String

font
Font

要套用至 tabItemTextFont

flags
TextFormatFlags

TextFormatFlags 值的位元組合。

image
Image

在索引標籤中繪製的 Image

imageRectangle
Rectangle

指定 image 繫結的 Rectangle

focused
Boolean

true 表示繪製焦點矩形,否則為 false

state
TabItemState

TabItemState 的其中一個值,指定索引標籤的可見狀態。

例外狀況

作業系統不支援視覺化樣式。

-或-

使用者已停用作業系統中的視覺化樣式。

-或-

視覺化樣式不適用於應用程式視窗的工作區。

備註

呼叫這個方法之前,您應該先 IsSupported 確認 屬性會傳 true 回 。

適用於