Solved

Hide MDI scroll bars

Posted on 2004-09-23
6
466 Views
Last Modified: 2007-12-19
Hi
Is it possible to hide main window's scrollbars?
0
Comment
Question by:vterekh
6 Comments
 
LVL 12

Expert Comment

by:esoftbg
ID: 12131097
 FormMain.HorzScrollBar.Visible := False;
  FormMain.VertScrollBar.Visible := False;
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12131104
It would be done by ObjectInspector at DesignTime ....
0
 
LVL 12

Expert Comment

by:esoftbg
ID: 12131131
Sorry, it does not work. I tested it without to try to move a ChildForm out of MainForm's size
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 22

Accepted Solution

by:
Ferruccio Accalai earned 125 total points
ID: 12131360
use this method (add it to the MDI mainform)

Function ClientWindowProc( wnd: HWND; msg: Cardinal; wparam,
                           lparam: Integer ): Integer; stdcall;
Var
  f: Pointer;
Begin
  f:= Pointer( GetWindowLong( wnd, GWL_USERDATA ));
  Case msg of
    WM_NCCALCSIZE: Begin
        If ( GetWindowLong( wnd, GWL_STYLE ) and
             (WS_HSCROLL or WS_VSCROLL)) <> 0
        Then
          SetWindowLong( wnd, GWL_STYLE,
                         GetWindowLong( wnd, GWL_STYLE )
                         and not (WS_HSCROLL or WS_VSCROLL));
      End;
  End;
  Result := CallWindowProc( f, wnd, msg, wparam, lparam );
End;

procedure TMainForm.FormCreate(Sender: TObject);
begin
If ClientHandle <> 0 Then Begin
    If GetWindowLong( ClientHandle, GWL_USERDATA ) <> 0 Then
      Exit;
    SetWindowLong( ClientHandle, GWL_USERDATA,
                   SetWindowLong( ClientHandle, GWL_WNDPROC,
                                  integer( @ClientWindowProc)));
  end;

end;

F68 ;-)
0
 
LVL 9

Expert Comment

by:ginsonic
ID: 12140100
or ovverride CreateWnd;

procedure TMyForm.CreateWnd;
var
 ClientCreateStruct: TClientCreateStruct;
begin
 inherited CreateWnd;
 if NewStyleControls then
   if BorderStyle <> bsDialog then
     SendMessage(Handle, WM_SETICON, 1, GetIconHandle) else
     SendMessage(Handle, WM_SETICON, 1, 0);
 if not (csDesigning in ComponentState) then
   case FormStyle of
     fsMDIForm:
       begin
         with ClientCreateStruct do
         begin
           idFirstChild := $FF00;
           hWindowMenu := 0;
           if FWindowMenu <> nil then hWindowMenu := FWindowMenu.Handle;
         end;
         FClientHandle := Windows.CreateWindowEx(WS_EX_CLIENTEDGE, 'MDICLIENT',
           nil, WS_CHILD or WS_VISIBLE or WS_GROUP or WS_TABSTOP or
           WS_CLIPCHILDREN or WS_CLIPSIBLINGS or
           MDIS_ALLCHILDSTYLES, 0, 0, ClientWidth, ClientHeight, Handle, 0,
           HInstance, @ClientCreateStruct);
         FClientInstance := MakeObjectInstance(ClientWndProc);
         FDefClientProc := Pointer(GetWindowLong(FClientHandle, GWL_WNDPROC));
         SetWindowLong(FClientHandle, GWL_WNDPROC, Longint(FClientInstance));
       end;
     fsStayOnTop:
       SetWindowPos(Handle, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE or
         SWP_NOSIZE or SWP_NOACTIVATE);
   end;
end;
0
 
LVL 34

Expert Comment

by:Slick812
ID: 12140108
you might try AutoScroll set to false

procedure TForm1.FormCreate(Sender: TObject);
begin
Form1.AutoScroll := False;
rnd;
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Delphi selector screen 2 84
Performance of SQL statement 37 127
CheckListBox usage 3 71
Microsoft Access 97 and Delphi XE2 9 53
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question