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 get the width and height of a MDI child form while dragging 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
21-Oct-02
Category
Others
Language
Delphi 2.x
Views
143
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

I need to know how to get the width and height of a MDI child window (or of an 
aligned component) before (!) and after scaling it with mouse dragging (e.g. 
dragging on the right bottom corner of the window). Which event provides these 
values at which time?

Answer:

There is no event directly usable for this but it can be done with a bit of API 
mixed in. When the user starts to drag on the border the window gets a 
WM_ENTERSIZEMOVE message, when the mouse goes up again it gets a WM_EXITSIZEMOVE 
message. So these are ideally suited to record old and new size. Note that the 
messages (as their name implies) are also send when the user moves the window by 
dragging on the caption. In that case the two sizes will simply be equal, so that 
is easy to test.

1   { ... }
2   private
3   FOldSize, FNewSize: TRect;
4   
5   procedure WMEnterSizeMove(var msg: TMessage); message WM_ENTERSIZEMOVE;
6   procedure WMExitSizeMove(var msg: TMessage); message WM_EXITSIZEMOVE;
7   { ... }
8   
9   procedure TProdBuilderMainForm.WMEnterSizeMove(var msg: TMessage);
10  begin
11    FOldSize := BoundsRect;
12  end;
13  
14  procedure TProdBuilderMainForm.WMExitSizeMove(var msg: TMessage);
15  begin
16    FNewSize := BoundsRect;
17    { ... do something with the sizes}
18  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