Is it possible to change the tooltip font size?

7 posts, 1 answers
  1. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 20 Aug 2014 Link to this post

    Telerik Members:

    Is it possible to change the tooltip font size?
  2. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 21 Aug 2014 in reply to Cooper Link to this post

    Another question:


    How to change the appointment height in month view? 


  3. UI for WinForms is Visual Studio 2017 Ready
  4. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 21 Aug 2014 Link to this post

    Hello Cooper,

    Thank you for writing.

    Before getting to your questions, I would like to kindly ask you to post the questions that are not related to each other in separate threads, in order to keep the forums more readable and easy to navigate. You can also have a look at the forum rules.

    Now to the questions at hand. 

    1. The tooltips in RadScheduler are controlled via the ToolTipTextNeeded event, which will get triggered when an element is hovered. There you have the ability to check the hovered element and set its tooltip. The toolips we use are the standard ones, coming from .NET. The way to change the font of them is to handle the tooltip's Draw event. Here is a nice article about this. Here is also a small example. 
    protected override void OnLoad(EventArgs e)
    {
        base.OnLoad(e);
        InitializeComponent();
     
     
        AddScheduler();
        radScheduler1.ToolTipTextNeeded += radScheduler1_ToolTipTextNeeded;
    }
     
    string schedulerToolTip = "toolTipText";
     
    void radScheduler1_ToolTipTextNeeded(object sender, ToolTipTextNeededEventArgs e)
    {
        e.ToolTipText = schedulerToolTip;
     
        e.ToolTip.OwnerDraw = true;
     
        e.ToolTip.Popup -= ToolTip_Popup;
        e.ToolTip.Popup += ToolTip_Popup;
     
        e.ToolTip.Draw -= ToolTip_Draw;
        e.ToolTip.Draw += ToolTip_Draw;
    }
     
    void ToolTip_Popup(object sender, PopupEventArgs e)
    {
        e.ToolTipSize = TextRenderer.MeasureText(schedulerToolTip, new Font("Arial", 16.0f));
        Console.WriteLine(e.ToolTipSize);
    }
     
    void ToolTip_Draw(object sender, DrawToolTipEventArgs e)
    {
        using (e.Graphics)
        {
            Font f = new Font("Arial", 16.0f);
            e.DrawBackground();
            e.DrawBorder();
            schedulerToolTip = e.ToolTipText;
            e.Graphics.DrawString(e.ToolTipText, f, Brushes.Red, new Point(2,2));
     
        }
    }

    Note that due to the fact the ToolTipText needed is fired upon hovering an element in the control, I am first unsubscribing from the events prior subscribing, in order to avoid multiple subscriptions.

    2. Here is how to change the appointment height in month view:
    SchedulerMonthViewElement monthView = this.radScheduler1.SchedulerElement.ViewElement as SchedulerMonthViewElement;
    if (monthView != null)
    {
        monthView.AppointmentHeight = 60;
    }

    I hope that you find this information useful. Should you have any other questions, do not hesitate to contact us.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  5. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 21 Aug 2014 in reply to Stefan Link to this post

    Very Thanks you help.  I will separate the questions that not related each other in next time.

    (1)  How to change the appointment in month view?

    But it is not work when I had added the code in the Form_load.

    SchedulerMonthViewElement monthView = this.radScheduler1.SchedulerElement.ViewElement as SchedulerMonthViewElement;

    if (monthView != null)
    {
        monthView.AppointmentHeight = 60;
    }














  6. Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 22 Aug 2014 Link to this post

    Hi,

    Can you check if you can break in the if statement? If you can't it means that the view is not yet changed, so you need to execute the code once it is.

    I hope this helps.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
  7. Cooper
    Cooper avatar
    19 posts
    Member since:
    Mar 2014

    Posted 24 Aug 2014 in reply to Stefan Link to this post

    Very thank your response.

    It is work in single schedule.  But there is one problem in multi scheduler.

    I don’t know why the appointment has the different appointment height value in multi schedule.

    How to set the appointment height value in multi scheduler? 
  8. Answer
    Stefan
    Admin
    Stefan avatar
    2891 posts

    Posted 26 Aug 2014 Link to this post

    Hi,

    Here is how to do that in grouped scheduler as well:
    private void radButton1_Click(object sender, EventArgs e)
    {
        SchedulerMonthViewGroupedByResourceElement groupedElement = this.radScheduler1.SchedulerElement.ViewElement as SchedulerMonthViewGroupedByResourceElement;
        if (groupedElement != null)
        {
            foreach (RadElement currentElement in groupedElement.Children)
            {
                SchedulerMonthViewElement monthViewElement = currentElement as SchedulerMonthViewElement;
                if (monthViewElement != null)
                {
                    monthViewElement.AppointmentHeight = 50;
                }
            }
        }
    }

    I hope that you find this information useful.

    Regards,
    Stefan
    Telerik
     
    Check out Telerik Analytics, the service which allows developers to discover app usage patterns, analyze user data, log exceptions, solve problems and profile application performance at run time. Watch the videos and start improving your app based on facts, not hunches.
     
Back to Top
UI for WinForms is Visual Studio 2017 Ready