TabRenderer.DrawTabItem Método

Definición

Dibuja una ficha utilizada para seleccionar una página en el control de ficha.

Sobrecargas

DrawTabItem(Graphics, Rectangle, TabItemState)

Dibuja una ficha en el estado y con los límites especificados.

DrawTabItem(Graphics, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, y con un rectángulo de foco opcional.

DrawTabItem(Graphics, Rectangle, String, Font, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, y con el texto indicado.

DrawTabItem(Graphics, Rectangle, Image, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con la imagen especificada y con un rectángulo de foco opcional.

DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con el texto especificado y con un rectángulo de foco opcional.

DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con el texto y el formato de texto especificados, y con un rectángulo de foco opcional.

DrawTabItem(Graphics, Rectangle, String, Font, Image, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con la imagen y el texto especificados, y con un rectángulo de foco opcional.

DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con el texto, el formato de texto y la imagen especificados, y con un rectángulo de foco opcional.

DrawTabItem(Graphics, Rectangle, TabItemState)

Dibuja una ficha en el estado y con los límites especificados.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, y con un rectángulo de foco opcional.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

focused
Boolean

Es true para dibujar un rectángulo de foco; de lo contrario, es false.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, String, Font, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, y con el texto indicado.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

tabItemText
String

String que se va a dibujar en la ficha.

font
Font

Font que se va a aplicar a tabItemText.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, Image, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con la imagen especificada y con un rectángulo de foco opcional.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

image
Image

Image que se va a dibujar en la ficha.

imageRectangle
Rectangle

Rectangle que especifica los límites de image.

focused
Boolean

Es true para dibujar un rectángulo de foco; de lo contrario, es false.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con el texto especificado y con un rectángulo de foco opcional.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

tabItemText
String

String que se va a dibujar en la ficha.

font
Font

Font que se va a aplicar a tabItemText.

focused
Boolean

Es true para dibujar un rectángulo de foco; de lo contrario, es false.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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 DrawTabItem(Graphics, Rectangle, String, Font, Boolean, TabItemState) método en el método de OnPaint un control personalizado para dibujar un elemento de ficha. Este ejemplo de código es parte de un ejemplo mayor proporcionado para la clase 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

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con el texto y el formato de texto especificados, y con un rectángulo de foco opcional.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

tabItemText
String

String que se va a dibujar en la ficha.

font
Font

Font que se va a aplicar a tabItemText.

flags
TextFormatFlags

Combinación bit a bit de los valores de TextFormatFlags.

focused
Boolean

Es true para dibujar un rectángulo de foco; de lo contrario, es false.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, String, Font, Image, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con la imagen y el texto especificados, y con un rectángulo de foco opcional.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

tabItemText
String

String que se va a dibujar en la ficha.

font
Font

Font que se va a aplicar a tabItemText.

image
Image

Image que se va a dibujar en la ficha.

imageRectangle
Rectangle

Rectangle que especifica los límites de image.

focused
Boolean

Es true para dibujar un rectángulo de foco; de lo contrario, es false.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a

DrawTabItem(Graphics, Rectangle, String, Font, TextFormatFlags, Image, Rectangle, Boolean, TabItemState)

Dibuja una ficha en el estado y con los límites especificados, con el texto, el formato de texto y la imagen especificados, y con un rectángulo de foco opcional.

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)

Parámetros

g
Graphics

Graphics que se utiliza para dibujar la ficha.

bounds
Rectangle

Rectangle que especifica los límites de la ficha.

tabItemText
String

String que se va a dibujar en la ficha.

font
Font

Font que se va a aplicar a tabItemText.

flags
TextFormatFlags

Combinación bit a bit de los valores de TextFormatFlags.

image
Image

Image que se va a dibujar en la ficha.

imageRectangle
Rectangle

Rectangle que especifica los límites de image.

focused
Boolean

Es true para dibujar un rectángulo de foco; de lo contrario, es false.

state
TabItemState

Uno de los valores de TabItemState que especifica el estado visual de la ficha.

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.

Comentarios

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

Se aplica a