Leer en inglés

Compartir a través de


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)

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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

C#
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, System.Windows.Forms.VisualStyles.TabItemState state);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

DrawTabItem(Graphics, Rectangle, Boolean, TabItemState)

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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

C#
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, bool focused, System.Windows.Forms.VisualStyles.TabItemState state);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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

C#
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string tabItemText, System.Drawing.Font font, System.Windows.Forms.VisualStyles.TabItemState state);
C#
public static void DrawTabItem(System.Drawing.Graphics g, System.Drawing.Rectangle bounds, string? tabItemText, System.Drawing.Font? font, System.Windows.Forms.VisualStyles.TabItemState state);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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

C#
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);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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

C#
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);
C#
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);

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.

C#
// 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";
}

Comentarios

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

Se aplica a

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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.

C#
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);
C#
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);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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.

C#
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);
C#
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);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

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

Source:
TabRenderer.cs
Source:
TabRenderer.cs
Source:
TabRenderer.cs

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.

C#
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);
C#
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);

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

.NET Framework 4.8.1 y otras versiones
Producto Versiones
.NET Framework 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10