Custom tooltip control in WinForms

前端 未结 1 1821
[愿得一人]
[愿得一人] 2021-01-19 18:09

Is there a simple way to create and show a custom tooltip control in C# / WinForms?

My current thinking is either:

  • create a subclass of Tooltip, o

相关标签:
1条回答
  • 2021-01-19 19:05

    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);
    
    0 讨论(0)
提交回复
热议问题