Hello Everyone,
I am trying to manually create a timeline that shows the current time on an ultra day view, i have used the code below to alter the timeslotuielement to show a red line. It works great except it is always behind the appointment, any ideas on how to get it to always be infront?
Dim timeElement As TimeSlotUIElement = DirectCast(drawParams.Element, TimeSlotUIElement)
Dim timeSlot As TimeSlot = CType(timeElement.GetContext(GetType(TimeSlot), True), TimeSlot) Dim calInfo As UltraCalendarInfo = timeSlot.DayView.CalendarInfo
If dt > Now.AddMinutes(-increment) And dt < Now Then
Dim diffMin As Integer = (Now.Minute - dt.Minute) * integers drawParams.AppearanceData.ForeColor = Color.Red
Dim colorSlot As ImageUIElement = New ImageUIElement(timeElement, My.Resources.red) colorSlot.Rect = New System.Drawing.Rectangle(timeElement.Rect.X, timeElement.Rect.Y + (diffMin), timeElement.Rect.Width, 1.5) timeElement.ChildElements.Add(colorSlot)
End If
Hi Matthew,
This code is a bit confusing. You don't say what event or method this code is in. Since you are referencing 'drawparams', it seems like this is in the DrawElement method. But a DrawFilter is only intended to be used to affect the drawing of an element. You should not create new UIElements and add them into the hierarchy using a DrawFilter - that's what a CreationFilter is for.
If you just want to show a line at the current time in the DayView, all you have to do is set CurrentTimeIndicatorVisible to true. Were you not aware of this property? Or are you trying to do something different like extend this line or change the color?
Sorry I didn't really include much detail as I am new to programming. I am using a new IUIElementDrawFilter method and the InitApearance, not sure if that is right but it seems to work. The problem I am having is that this is an addin for a program called Act! that uses your Calendar component but there is no CurrentTimeInidicatorVisible in there version of your control, maybe because it is an old version so I am forced to try and make my own. Any help you can offer would be great.
Now I'm even more confused. Are you using a DataFilter or InitAppearance? Those are two completely different things. I can't see any reason why you would need InitAppearance here. That would mean deriving your own UIElement, which you really don't need to do - and as I mentioned, adding new Elements using a DrawFilter is not a good idea.
Since I'm still not sure which element(s) you are using, it's tough for me to give you any further guidance here. Can you send me a screen shot or a mockup of exactly what you want?