Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to correctly maximize a window Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
30-Aug-02
Category
Others
Language
Delphi 2.x
Views
72
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Tomas Rutkauskas

I have some forms with the property WindowState set to wsMaximized. The problem is 
that some forms are hiding the taskbar. I can't find the problem since some others 
forms are working fine.

Answer:

Solve 1:

If I'm right, the only way to get correctly maximized windows (regarding the 
taskbar and other "taskbar like" windows) is using API functions:


1   var
2     x: pointer;
3     r: TRect;
4   begin
5     x := Addr(r);
6     SystemParametersInfo(SPI_GETWORKAREA, 0, x, 0);
7     Left := 0;
8     Width := r.Right;
9     Top := 0;
10    Height := r.Bottom;
11    { ... }



Solve 2:

This seems to be a particular problem when you do it in the forms OnCreate event. 
To fix it add a handler for the WM_GETMINMAXINFO message:


private
12  { Private declarations }
13  
14  procedure wmGetMinMaxInfo(var msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;
15  
16    procedure TForm1.wmGetMinMaxInfo(var msg: TWMGetMinMaxInfo);
17    var
18      r: TRect;
19    begin
20      SystemParametersInfo(SPI_GETWORKAREA, 0, @r, 0);
21      with msg.MinMaxInfo^ do
22      begin
23        ptMaxSize := r.BottomRight;
24        ptMaxPosition := r.TopLeft;
25      end;
26    end;



If your form is set to Position := poDesigned and WindowState := wsMaximized, then don't set any value for Constraints. Otherwise the form won't maximize correctly at runtime, if the Windows taskbar is resized.

			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC