Appointment Icon

4 posts, 1 answers
  1. Chris Scallion
    Chris Scallion avatar
    9 posts
    Member since:
    Jun 2010

    Posted 12 Jan 2011 Link to this post

    We'd like to have the ability to add icon overlays to appointments. I don't see this functionality documented anywhere, so I assume that its not implemented directly. So my next question's would be:

    Are appointments drawn using their own individual OnDraw() ? If so, where do I look to grab the drawing rectangle and graphics handle for an appointment object. 

    If they are drawn on the schedule using the GDI graphics object of the scheduler grid, is there and accessible collection of rects for the current view, or would the control have to be extended manually. Obviously the latter option would be a last resort, since the layout logic would be a lot of work.

    I know I could look at the source and find this out on my own, but where is the fun in that.

    Thanks,
    Chris
  2. Answer
    Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Jan 2011 Link to this post

    Hi Chris,

    Yes, you can add an appointment icon in the RadScheduler. You'll need to use the appointment formatting event. For exmaple
    Private Sub RadScheduler1_AppointmentFormatting(ByVal sender As System.Object, ByVal e As Telerik.WinControls.UI.SchedulerAppointmentEventArgs) Handles RadScheduler1.AppointmentFormatting
        ' if {condition} (e.g. e.Appointment.BackgroundId = 1 then
        e.AppointmentElement.Image = Image.FromFile("C:\Img.gif")
        e.AppointmentElement.ImageAlignment = ContentAlignment.MiddleLeft
    End Sub

    Hope that helps but let me know if you need more information
    Richard
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Chris Scallion
    Chris Scallion avatar
    9 posts
    Member since:
    Jun 2010

    Posted 12 Jan 2011 Link to this post

    Nice! Take $20 out of petty cash and tell em I said it was ok :-)

    However, for anyone else looking for this info, it needs to be noted that setting:
    e.AppointmentElement.ImageAlignment 

    Will not give your the desired alignment unless you also set:
    e.AppointmentElement.ImageLayout = ImageLayout.None

    Which is apparently set to Center by default. On a side note, this AppointmentElement also exposes the drawing rectangle, so you can do what you want via GDI as well.

    Again, thanks a bunch Richard!
  5. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 12 Jan 2011 Link to this post

    No problem, Chris. Glad that helped.
    ($20 received from petty cash!) :o)
    Regards
    Richard
Back to Top