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
MDI application without annoying ScrollBars 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
17-Jun-03
Category
Others
Language
Delphi 2.x
Views
75
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Rafael Cotta

I've been trying to create a MDI form without those annoying scrollbars when a 
child form is moved outside main form area and I couldn't find an easy way. Setting 
the scrollbars to visible := false won't work! 
So, I found an example on a newsgroup... yeah! Here I show how to do it.

Answer:

It's a two step proccess. 

Step one : put the code below inside the OnCreate event of the main form. 

1   if ClientHandle <> 0 then
2   begin
3     if (not (GetWindowLong(ClientHandle, GWL_USERDATA) <> 0)) then
4     begin
5       SetWindowLong(
6         ClientHandle,
7         GWL_USERDATA,
8         SetWindowLong(ClientHandle, GWL_WNDPROC, integer
9         (@ClientWindowProc))
10        );
11    end;
12  end;


Step two: Put this standalone function inside the unit that contains the main form, 
before the OnCreate event (once OnCreate references to this function). 
13  
14  function ClientWindowProc(wnd: HWND; msg: Cardinal; wparam, lparam: Integer): 
15  Integer;
16    stdcall;
17  var
18    f: Pointer;
19  begin
20    f := Pointer(GetWindowLong(wnd, GWL_USERDATA));
21    case msg of
22      WM_NCCALCSIZE:
23        begin
24          if (
25            GetWindowLong(wnd, GWL_STYLE) and
26            (WS_HSCROLL or WS_VSCROLL)) <> 0 then
27            SetWindowLong(
28              wnd,
29              GWL_STYLE,
30              GetWindowLong(wnd, GWL_STYLE) and not
31              (WS_HSCROLL or WS_VSCROLL)
32              );
33        end;
34    end;
35    Result := CallWindowProc(f, wnd, msg, wparam, lparam);
36  end;


That's it!!! 

The code was originally posted by Peter Below in a newsgroup (borland.public.delphi.objectpascal). I've made some little changes. 

			
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