I am writing a control based on the UltraDayView (inherits UltraDayView) which requires a lot of custom GDI+ work.
One of the problems I'm running into is my inability to control the invalidation of certain parts of the control. As I move the mouse, resize the window, etc, the UltraDayView marks certain areas as invalidated and I can't stop it. Overriding OnInvalidated obviously doesn't help because at that point the areas have already been marked for repainting. It would be great if there was an event like OnBeforeInvalidate(_invalidRect) so that I could control what areas are to be redrawn, but of course one does not exist.
Is there a way I can turn off all or refreshing done by the UltraDayView itself or perhaps just control the rectange/region being passed to invalidate? Perhaps by overriding WndProc? Perhaps through some underlying Infragistics mechanism I am not aware of?
Thanks,
Raphael
Using UIElements and a DrawFilter here will be problemetic, because you can't be sure of the order in which the elements will draw. So if you use the AfterDrawElement of an Appointment, for example, you can't be sure that some other element won't draw into an area outside the appointment that you have already drawn on.
You can't (and probably shouldn't) control the invalidation of the control.
But if you are trying to paint a complex object over the DayView control, then it seems like me like you might be better off just overriding the OnPaint, calling the base, and then painting whatever you want on top of the control.
This may not be the most efficient way to do it, because the DayView will be drawing a bunch of stuff that will get covered up by your drawng. But it will certainly be the simplest way.
I would like to take a look at that stripped down sample. It will give me a better idea of how to address your issue.
Yes, that is exactly right.
One of the things the parent control needs to do is draw custom context menus/sub-windows on top of the UltraDayView controls and the repainting of the different UIElements is paining over these windows. The region I want to keep from painting is arbitrary (does not map to any specific UIElement within the UltraDayView) and often spans parts of several UltraDayView controls and many UIElements within each.
I can send a stripped down sample to show you what is happening if that would be helpful.
Thanks again!
I've never used WS_CLIPCHILDREN but from your description it seems that you want to keep certain parts of the dayview from repainting so that it does not get paint over your parent control.
Could you provide a screenshot of specifically what portions you want to keep from painting. Is it a general region?
If I have misunderstood, can you provide further details. Images will probably help.
Sung,
Thank you for your reply. I am already using GetPhasesToFilter/DrawElement rather than overriding OnPaint in order to customize my inherited UltraDayView control. However, I need to do something more complex. I have a parent control that needs to draw on top of the child UltraDayView controls contained within it (using WS_CLIPCHILDREN). The problem is that I need to be able to control specifically which part of the UltraDayView control is being invalidated, otherwise managing the repainting in my parent control becomes unmanageable.
I'd love to get some ideas on how this could be accomplished.
Please let me know if what I'm describing makes any sense.