WinForms tooltip user control

Is there an easy way to create and show a custom tooltip element in C # / WinForms?

My current thinking:

  • subclass Tooltip, override OnPaint method, set it as a parental control hint

  • subclass the form and show it manually

Any thoughts?

+4
source share
1 answer

It depends on what you need to prompt your tool. If you only need a tool tip with a ball shape, animation and fading effects with a custom text color and background, it’s easier to use the 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); 
+3
source

Source: https://habr.com/ru/post/1337343/


All Articles