This is a migrated thread and some comments may be shown as answers.

RadToolTip BackColor is not working

6 Answers 317 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Amal
Top achievements
Rank 1
Amal asked on 09 May 2017, 01:52 PM

Hi Team,

 

I have changed the backcolor of the tooltip with below code but it is not working,

 

RadToolTip toolTip = new RadToolTip();
toolTip.IsBalloon = true;
toolTip.BackColor = Color.LightSkyBlue;
toolTip.SetToolTip(this.button1, "Telerik test");

6 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 May 2017, 12:15 PM
Hello Amal, 

Thank you for writing.  

RadToolTip is a derivative of the MS ToolTip. The following StackOverflow thread demonstrates a sample approach how to customize the BackColor: http://stackoverflow.com/questions/12990757/change-winform-tooltip-backcolor

Here is a sample code snippet: 
public RadForm1()
{
    InitializeComponent();
     
    this.radButton1.ShowItemToolTips = true;
    this.radButton1.ToolTipTextNeeded += radButton1_ToolTipTextNeeded;
}
 
private void radButton1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
{
    e.ToolTip.BackColor = Color.Yellow;
    e.ToolTip.ForeColor = Color.Red;
    e.ToolTipText = "Telerik button";
    e.ToolTip.OwnerDraw = true;
    e.ToolTip.Draw += ToolTip_Draw;
}
 
private void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
{
    ToolTip toolTip = sender as ToolTip;
 
    e.Graphics.FillRectangle(new SolidBrush(toolTip.BackColor), e.Bounds);
    e.DrawBorder();        
    e.DrawText(TextFormatFlags.Left);
}

I hope this information helps. Should you have further questions I would be glad to help.


Regards,
Dess
Telerik by Progress
Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
jiang
Top achievements
Rank 1
answered on 08 Nov 2019, 09:07 AM

hi, Dess | Tech Support Engineer, Sr.

 

     It works with your method. but, I want to change the pop-up position too, what should I do?

      Thank you very much

0
Nadya | Tech Support Engineer
Telerik team
answered on 08 Nov 2019, 02:13 PM

Hello,

If you want to change the position of the tooltip you can use one of the Show method overrides. More information is available here: https://docs.telerik.com/devtools/winforms/telerik-presentation-framework/tooltips-and-screentips/radtooltip#radtooltip

 private void radButton1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
 {
     RadToolTip newToolTip = new RadToolTip();
     newToolTip.BackColor = Color.Yellow;
     newToolTip.ForeColor = Color.Red;
     newToolTip.OwnerDraw = true;
     newToolTip.InitialDelay = 2000;
     newToolTip.Show("Telerik button", new Point(200, 200));
     e.ToolTipText = "";
 }

Do not hesitate to contact us if you have other questions.

Regards,
Nadya
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
0
jiang
Top achievements
Rank 1
answered on 09 Nov 2019, 03:00 AM

Hello, Dess | Tech Support Engineer, Sr.

Thanks for your reply, why didn't it autoclose?

I didn't find a way.

0
jiang
Top achievements
Rank 1
answered on 09 Nov 2019, 03:41 AM

Hello, Dess | Tech Support Engineer, Sr.

I did this with the control's MouseLeave event, thanks for your help.

0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 11 Nov 2019, 02:27 PM
Hello, Jiang, 

Usually, the tool-tip is displayed below the control. The easiest way to manipulate its position is to specify the ToolTipTextNeededEventArgs.Offset property instead of creating a brand new instance of RadToolTip and showing it programamtically. Thus, you are not expected to experience any issues with hiding the tool-tip which is shown by default. 
        private void radButton1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
        {
            e.Offset = new System.Drawing.Size(20,20);
            e.ToolTipText = "Telerik button";
        }
I hope this information helps.

 

Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik

Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
General Discussions
Asked by
Amal
Top achievements
Rank 1
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
jiang
Top achievements
Rank 1
Nadya | Tech Support Engineer
Telerik team
Share this question
or