ToolStripItem.ToolTipText 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定顯示為控制項的 ToolTip 之文字。
public:
property System::String ^ ToolTipText { System::String ^ get(); void set(System::String ^ value); };
public string ToolTipText { get; set; }
public string? ToolTipText { get; set; }
member this.ToolTipText : string with get, set
Public Property ToolTipText As String
屬性值
字串,表示工具提示文字。
範例
下列程式碼範例示範如何設定 Image 的 、 ImageScaling 和 ImageTransparentColorToolStripItem 。 此外,還會示範如何設定和顯示專案的自訂工具提示。
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
備註
ToolTipText只有在 設定為 true
時才 ShowItemToolTips 適用。 如果 AutoToolTip 設定為 true
,則會 Text 使用專案的 屬性做為 ToolTipText 。