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

Is it possible to change the tooltip font size?

6 Answers 1390 Views
Scheduler and Reminder
This is a migrated thread and some comments may be shown as answers.
Cooper
Top achievements
Rank 1
Cooper asked on 20 Aug 2014, 09:39 AM
Telerik Members:

Is it possible to change the tooltip font size?

6 Answers, 1 is accepted

Sort by
0
Cooper
Top achievements
Rank 1
answered on 21 Aug 2014, 05:41 AM
Another question:


How to change the appointment height in month view? 


0
Stefan
Telerik team
answered on 21 Aug 2014, 08:36 AM
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.
 
0
Cooper
Top achievements
Rank 1
answered on 22 Aug 2014, 12:52 AM
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;
}














0
Stefan
Telerik team
answered on 22 Aug 2014, 10:33 AM
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.
 
0
Cooper
Top achievements
Rank 1
answered on 25 Aug 2014, 02:59 AM
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? 
0
Accepted
Stefan
Telerik team
answered on 26 Aug 2014, 10:24 AM
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.
 
Tags
Scheduler and Reminder
Asked by
Cooper
Top achievements
Rank 1
Answers by
Cooper
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or