ToolStripItem.ToolTipText Propiedad

Definición

Obtiene o establece el texto que aparece como ToolTip para un control.

C#
public string ToolTipText { get; set; }
C#
public string? ToolTipText { get; set; }

Valor de propiedad

Cadena que representa el texto de información sobre herramientas.

Ejemplos

En el ejemplo de código siguiente se muestra cómo establecer , ImageImageScalingy ImageTransparentColor para .ToolStripItem Además, muestra cómo establecer y mostrar una información sobre herramientas personalizada para el elemento.

C#
internal ToolStripButton imageButton;

private void InitializeImageButtonWithToolTip()
{

    // Construct the button and set the image-related properties.
    imageButton = new ToolStripButton();
    imageButton.Image = new Bitmap(typeof(Timer), "Timer.bmp");
    imageButton.ImageScaling = ToolStripItemImageScaling.SizeToFit;

    // Set the background color of the image to be transparent.
    imageButton.ImageTransparentColor = Color.FromArgb(0, 255, 0);

    // Show ToolTip text, set custom ToolTip text, and turn
    // off the automatic ToolTips.
    toolStrip1.ShowItemToolTips = true;
    imageButton.ToolTipText = "Click for the current time";
    imageButton.AutoToolTip = false;

    // Add the button to the ToolStrip.
    toolStrip1.Items.Add(imageButton);
}

Comentarios

ToolTipText solo funciona si ShowItemToolTips se establece trueen . Si AutoToolTip se establece trueen , la Text propiedad del elemento se usa como ToolTipText.

Se aplica a

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