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!

Form.Position:=poDesktopCenter - what about the start bar?

Status
Not open for further replies.

TimSNL

Programmer
Sep 11, 2001
119
AU
Hello,

I need my form to be as large as possible, to fill the screen and yet not be maximised. When I use Form.Position:=poDesktopCenter it puts it in the center of the screen and the start bar cuts off the bottom of the form X-)

How can I get the form to position itself centered between the top of the screen and the top of the start bar?

Tim Dover
SNL Computing
 
Code:
var
        rect: TRect;
begin
        SystemParametersInfo(SPI_GETWORKAREA, 0, @rect, 0);
        Form.Left := rect.Left;
        Form.Top := rect.Top;
        Form.Width := rect.Right - rect.Left;
        Form.Height := rect.Bottom - rect.Top;
 
Or you could just set the forms align property to alClient thus filling the client workspace without maximising the form!
 
MikeEd and EricDraven, thankyou both for your help. I have come up with a solution which uses both of your suggestions. :)

I was only having trouble getting my large windows to fit in 800x600, the higher resolutions are no problem of course. After reading mike's suggestion I looked around and found Screen.WorkAreaHeight (etc) and decided to use this to test for the resolution.

if (Screen.WorkAreaWidth < 850) then Form.Align := alClient;

This looks like it will work ok.
Thanks for your help. s-)

Tim Dover
SNL Computing
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top