TabRenderer.DrawTabPage(Graphics, Rectangle) Método

Definición

Dibuja una página de fichas en los límites especificados.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la página de fichas.

bounds
Rectangle

Rectangle que especifica los límites de la página de fichas.

Excepciones

El sistema operativo no admite estilos visuales.

o bien

El usuario ha deshabilitado los estilos visuales en el sistema operativo.

o bien

Los estilos visuales no se aplican al área de cliente de las ventanas de aplicación.

Ejemplos

En el ejemplo de código siguiente se usa el DrawTabPage método en el método de OnPaint un control personalizado para dibujar una página de tabulación. Este ejemplo de código forma parte de un ejemplo más grande proporcionado para la TabRenderer clase .

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

Comentarios

Antes de llamar a este método, debe comprobar que la IsSupported propiedad devuelve true.

Se aplica a