Resize question

  • Thread starter Thread starter web1110
  • Start date Start date
W

web1110

When a resize event occurs, how do I determine if the resize is due to a

User resize
Minimize
Maximize
Restore

Thanx,
Bill
 
A follow up.

On investigating this, I encountered occasions when the location of the form
(actually a control) I am playing with has values of .X and .Y that are less
than zero. What does this mean?
 
In the Resize event, or the OnResize override, look at the Form's
WindowState property. This should tell you if the Form is "Normal",
"Minimized", or "Maximized". If the X or Y values are negative it would be
because either the left or top of the Form, or Control, is outside of the
visible area of the screen or container.
 
More info

The problem:

I am building entirely self contained classes within windows controls.

When I resize the parent window upon which the control sits, I reposition
the control to the center of the parent.

Manual resize is ok. If I enlarge the parent, the control stays centered.
If I shrink the parent below the size of the control, it re-expands to the
control size.

However, when I minimize and restore, strange things occur. The centering
code moves the child control to the left, I see negative location X and Y
values. I haven't perceived a solid pattern yet except that my problems
occur with maximize,minimize and restore.

Using the layout event didn't help
 
Back
Top