ToolStripItem.ImageTransparentColor ToolStripItem.ImageTransparentColor ToolStripItem.ImageTransparentColor ToolStripItem.ImageTransparentColor Property

Definición

Obtiene o establece el color que se va a tratar como transparente en una imagen de ToolStripItem.Gets or sets the color to treat as transparent in a ToolStripItem image.

public:
 property System::Drawing::Color ImageTransparentColor { System::Drawing::Color get(); void set(System::Drawing::Color value); };
public System.Drawing.Color ImageTransparentColor { get; set; }
member this.ImageTransparentColor : System.Drawing.Color with get, set
Public Property ImageTransparentColor As Color

Valor de propiedad

Uno de los valores de Color.One of the Color values.

Ejemplos

En el ejemplo de código siguiente se muestra cómo Imageestablecer ImageScaling, y ImageTransparentColor para ToolStripItem.The following code example demonstrates how to set the Image, ImageScaling, and ImageTransparentColor for a ToolStripItem. Además, se muestra cómo establecer y mostrar una información sobre herramientas personalizada para el elemento.In addition, it demonstrates how to set and show a custom ToolTip for the item.

    ToolStripButton^ imageButton;

    void InitializeImageButtonWithToolTip()
    {

        // Construct the button and set the image-related properties.
        imageButton = gcnew ToolStripButton;
        imageButton->Image = 
            gcnew Bitmap(Timer::typeid,"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);
    }


    //   internal:

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

}
Friend WithEvents imageButton As ToolStripButton

Private Sub InitializeImageButtonWithToolTip()

    ' Construct the button and set the image-related properties.
    imageButton = New ToolStripButton()
    imageButton.Image = New Bitmap(GetType(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)

End Sub

Se aplica a