Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

My program remembers the height and

Status
Not open for further replies.

bearsite4

Programmer
Sep 29, 2001
79
AU
My program remembers the height and width of the program when it exits so it can restore it later.

The window starts at a default x by y say, then it correctly changes to the user's previous dimension p by q.
All's going well until the breakpoint at Application.Run.
After that one innocent looking statement is executed the height and width change to some random value.

Any hints? What goes on behind the scenes of Application.Run?
 
This sounds an interesting problem. Presumably you're saving the window size in the registry; do you then retrieve it and apply it to the window before CreateForm and Application.Run?
 
Yep, that's exactly what I do. It used to work fine, then I experienced a period of quirkyness but now it seems to be ok again.
 
Well, are you sure you are applying the height Before creating the Form?. That sound a little bit wrong to me.

I've done that a couple of times, and it has worked fins.
The only problem i have encountered is when the application quits in mininmized mode. Then the starting positions will be, like you said, random.

A solution to that is to initially check the Left, Top, Width, Height property.
Left and Top Must be larger than 0 and Width and Height must Not be larger that Screen.Width and Screen.Height Andreas Nordlund
Software developer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top