且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

WinForms中的自定义工具提示控件

更新时间:2022-12-11 15:45:30

这取决于您所需的工具提示.如果您只需要具有气球形状,动画和淡入淡出效果以及自定义文本颜色和背景的工具提示,则使用工具提示控件会更容易

It depends on what you need for your tool tip. If you only need a tool tip with balloon shape, animation and fading effects with custom text color and background, It is easier to use ToolTip control

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