Ruler text problem

3 posts, 0 answers
  1. Daniel Lindberg
    Daniel Lindberg avatar
    3 posts
    Member since:
    Apr 2010

    Posted 03 May 2010 Link to this post

    Im having some trouble with the ruler text format. The zeroes always gets overlapped with the hours and I can't figure out how to change it. I tried setting the RulerWidth property, but that didn't work. Screenshot is attached.

    Thank you,
  2. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 05 May 2010 Link to this post

    Hello Daniel Lindberg,

    Did you set any Font properties to the Scheduler control? What dpi settings do you use in your PC? 

    Another solution is to override the default rendering of the Ruler. You can achieve this by doing the following:

    1. Set the RulerRenderer property of the RulerPrimitive:
     
    SchedulerDayViewElement dayView = 
    this.radScheduler.SchedulerElement.ViewElement as SchedulerDayViewElement;
    dayView.DataAreaElement.Ruler.RulerRenderer = new 
    MyRulerRenderer(dayView.DataAreaElement.Ruler);
     
    2. Create a custom RulerRenderer class which will be set to the RulerPrimitive:

    public class MyRulerRenderer : RulerRenderer
     {
         public MyRulerRenderer(RulerPrimitive ruler)
             : base(ruler)
         {
         }
         public override void RenderHour(Telerik.WinControls.Paint.IGraphics g, int hour, Rectangle bounds)
         {
             g.DrawString(hour.ToString(), bounds, new Font(FontFamily.GenericSerif, 8.25f, FontStyle.Regular),
                 Color.Black, ContentAlignment.MiddleCenter, new StringFormat(), Orientation.Horizontal, false);
         }       
     }

    Do not hesitate to contact us, if you have more questions.

    All the best,
    Boyko Markov
    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Daniel Lindberg
    Daniel Lindberg avatar
    3 posts
    Member since:
    Apr 2010

    Posted 05 May 2010 Link to this post

    Using the custom render solved my problems. Thank you very much for your help!

    Regards,
    Daniel Lindberg
Back to Top