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 avoid flicker when moving or sizing a MDI child form 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
25-Oct-02
Category
Others
Language
Delphi 2.x
Views
115
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

I have an MDI application with many child forms. Their windowstate property is set 
to maximized. When a child form is created and shown, the form visibly resizes as 
it is shown. I would like the child form to open already maximized without the 
visible resizing. Any ideas?

Answer:

Preventing visible flicker when moving or sizing MDI children directly after their 
creation:

1   { ... }
2   public
3   { Public declarations }
4   
5   constructor Create(aOwner: TComponent); override;
6   end;
7   
8   implementation
9   
10  {$R *.DFM}
11  
12  constructor TMDIChild.Create(aOwner: TComponent);
13  var
14    crect: TRect;
15    chandle: HWND;
16  begin
17    { Get handle of MDI client window }
18    chandle := application.mainform.clienthandle;
19    { Block redrawing of this window and its children }
20    Lockwindowupdate(chandle);
21    { Create this MDI child at default position, it will not be drawn yet
22  	due to the update block }
23    inherited Create(aOwner);
24    { Get the client windows rect and center this form in it }
25    Windows.GetClientrect(chandle, crect);
26    SetBounds((crect.right - width) div 2, (crect.bottom - height) div 2, width,
27      height);
28    { Release the block, this allows the form to redraw at the new position }
29    LockWindowUpdate(0);
30  end;


			
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