ToolStripItem.ImageTransparentColor 속성

정의

ToolStripItem 이미지에서 투명하게 처리할 색을 가져오거나 설정합니다.

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

속성 값

Color

Color 값 중 하나입니다.

예제

다음 코드 예제에서는 설정 ImageScalingImageTransparentColor ToolStripItem하는 방법을 보여 줍니다.Image 또한 항목에 대한 사용자 지정 도구 설명을 설정하고 표시하는 방법을 보여 줍니다.

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

적용 대상