[英]Custom tooltip control in WinForms
有沒有一種簡單的方法來在C#/ WinForms中創建和顯示自定義工具提示控件?
我目前的想法是:
創建Tooltip的子類,重寫OnPaint方法,將其設置為父控件的工具提示
創建表單的子類並手動顯示它
有什么想法嗎?
這取決於您的工具提示所需的內容。 如果您只需要具有氣球形狀的工具提示,具有自定義文本顏色和背景的動畫和淡化效果,則使用ToolTip控件更容易
// Create your control
System.Windows.Forms.Button trialButton = new Button();
trialButton.Text = "Trial Button";
// Tool tip string
string toolTipText = "Hello World";
// ToolTip toolTip = new ToolTip(this.components);
ToolTip toolTip = new ToolTip();
toolTip.ToolTipTitle = "ToolTip Title";
toolTip.UseAnimation = true;
toolTip.UseFading = true;
toolTip.IsBalloon = true;
toolTip.Active = true;
toolTip.SetToolTip(button, toolTipText);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.