Bagikan melalui


TabRenderer.DrawTabPage(Graphics, Rectangle) Metode

Definisi

Menggambar halaman tab dalam batas yang ditentukan.

public:
 static void DrawTabPage(System::Drawing::Graphics ^ g, System::Drawing::Rectangle bounds);
public static void DrawTabPage(System.Drawing.Graphics g, System.Drawing.Rectangle bounds);
static member DrawTabPage : System.Drawing.Graphics * System.Drawing.Rectangle -> unit
Public Shared Sub DrawTabPage (g As Graphics, bounds As Rectangle)

Parameter

g
Graphics

Yang Graphics digunakan untuk menggambar halaman tab.

bounds
Rectangle

Rectangle yang menentukan batas halaman tab.

Pengecualian

Sistem operasi tidak mendukung gaya visual.

-atau-

Gaya visual dinonaktifkan oleh pengguna dalam sistem operasi.

-atau-

Gaya visual tidak diterapkan ke area klien jendela aplikasi.

Contoh

Contoh kode berikut menggunakan DrawTabPage metode dalam metode kontrol OnPaint kustom untuk menggambar halaman tab. Contoh kode ini adalah bagian dari contoh yang lebih besar yang disediakan untuk TabRenderer kelas .

    // 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

Keterangan

Sebelum memanggil metode ini, Anda harus memverifikasi bahwa IsSupported properti mengembalikan true.

Berlaku untuk