Page Index Toggle Pages: 1 Send TopicPrint
Normal Topic Determine the begin/end of a drawing phase (Read 4075 times)
Achim
Junior Member
**
Offline


MindFusion rocks!

Posts: 70
Location: Bayreuth, Germany
Joined: Jun 28th, 2012
Determine the begin/end of a drawing phase
Jan 30th, 2013 at 2:56pm
Print Post  
Hi there,

for standard controls, there is the Paint-event which should fire when the control is redrawn. Unfortunately the calendar control does not fire the paint event at any time.

For some custom drawings I want to make some precalculations which depend on the size of the control, the displayed time range and some other variables like the resource header width.

To prevent making these calculations for each and every custom drawn element I want to do these calculations before the control fires the first "Draw" or "ItemDrawing" event. Is there a way to achieve this?

Best regards and thanks for any help
Achim
  
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Determine the begin/end of a drawing phase
Reply #1 - Jan 30th, 2013 at 3:43pm
Print Post  
Hi,

You can inherit the Calendar class and override the OnPaint event, then perform the necessary calculations before calling the base's OnPaint.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Achim
Junior Member
**
Offline


MindFusion rocks!

Posts: 70
Location: Bayreuth, Germany
Joined: Jun 28th, 2012
Re: Determine the begin/end of a drawing phase
Reply #2 - Jan 31st, 2013 at 8:29am
Print Post  
Hi Meppy,

I was hoping I could prevent this, but it is a possibility of course. May I recommend for future releases of the control to integrate a "PrePaint" event?

Another thing I noticed during my tests is that the Paint/Draw events are fired even if there are no changes on the control - e.g. when the mouse hovers over the control. In scenarios with many elements and custom drawings this produces a heavy load on the CPU - maybe there is a way to reduce this?

Best regards
Achim
  
Back to top
WWW  
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Determine the begin/end of a drawing phase
Reply #3 - Jan 31st, 2013 at 9:01am
Print Post  
Hi,

We will try to add a Prepaint (or similar) event in the next release.

The repaints on mouse move are most likely happening when the mouse enters or leaves an item and the extended item styles are enabled. You can turn these styles off through the ItemSettings.UseExtendedStyles property. Alternatively, in your Draw event handler you can check the Graphics.ClipBounds property and perform custom drawing only when it happens inside the clip region.

Let me know if this helps.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Meppy
God Member
*****
Offline


MindFusion support

Posts: 1783
Joined: Jul 20th, 2005
Re: Determine the begin/end of a drawing phase
Reply #4 - Mar 1st, 2013 at 12:30pm
Print Post  
Check out this version:

https://mindfusion.eu/_temp/MindFusion.Scheduling.5.4.4.trial.zip

It adds two new events to the Calendar class - BeginItemDrawing and EndItemDrawing, signaling the beginning and the end of the item drawing phase.

Regards,
Meppy
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint