tags:

views:

74

answers:

2

In order to compare performance of custom drawing I need to calculate the time a form takes to resize (or maximize - pass from its normal to maximized state).

Where should I start / stop the StopWatch?

Tried OnResize/OnSizeChanged and also OnResizeBegin/OnResizeEnd but both depends of how quick I drag the mouse...

A: 

In the form's Resize and SizeChanged events. SizeChanged is first, start there, then Resize.

You might need to use the Layout event. Check event's documentation for event order.

Also, you may find EventSpy helpful. There is an option for a timestamp and you can "spy" on certain events of specific controls. (EventSpy at ftp://missico.net/EventSpy.zip.)

AMissico
As far as I read, Layout is like Resize, I know only the startPoint... EventSpy... son't know, but think the problem remain the same, the endpoint. By the way I try to measure the `OnPaint + OnPaintBackground` performance.
serhio
Nor Resize/OnSizeChanged didn't help, see the update.
serhio
@serhio: Do not use human interaction to set maximize. Do it through code. Create a method that does this, and using Stopwatch in this method.
AMissico
@AMissico: "human interaction" was used not for maximize(this action is done in a click) but for resize the form... And for use in a method I need a method Maximize, but this is a property that I suppose does asynchrously the maximization...
serhio
@serhio: To resize, change the form's size through code. Create a module with "sub main", start application through the main procedure, create form, show form, set form's size property. Do the same for form's window state. Also, do for form's location.
AMissico
A: 

Temporary solution is to use (on the parent Form) New(constructor) ==> OnShown. This is, surely, not just the resizing time but at least does not depend of the user speed of drag...

serhio