RadToolTip BackColor is not working

7 posts, 0 answers
  1. Amal
    Amal avatar
    1 posts
    Member since:
    Jan 2017

    Posted 09 May 2017 Link to this post

    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");
  2. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3625 posts

    Posted 11 May 2017 Link to this post

    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.
  3. jiang
    jiang avatar
    12 posts
    Member since:
    Apr 2019

    Posted 08 Nov 2019 in reply to Dess | Tech Support Engineer, Sr. Link to this post

    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

  4. Nadya
    Admin
    Nadya avatar
    190 posts

    Posted 08 Nov 2019 Link to this post

    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.
  5. jiang
    jiang avatar
    12 posts
    Member since:
    Apr 2019

    Posted 08 Nov 2019 in reply to Nadya Link to this post

    Hello, Dess | Tech Support Engineer, Sr.

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

    I didn't find a way.

  6. jiang
    jiang avatar
    12 posts
    Member since:
    Apr 2019

    Posted 08 Nov 2019 in reply to jiang Link to this post

    Hello, Dess | Tech Support Engineer, Sr.

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

  7. Dess | Tech Support Engineer, Sr.
    Admin
    Dess | Tech Support Engineer, Sr.  avatar
    3625 posts

    Posted 11 Nov 2019 Link to this post

    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.
Back to Top