3 de fev. de 2005

Como ocultar as barras de rolagem em um aplicativo MDI?

No fórum ClubeDelphi apareceu esta rotina para ocultar as barras de rolagem de um form MDI pai:

1 type 2 TForm1 = class(TForm) 3 procedure FormCreate(Sender: TObject); 4 ... 5 6 implementation 7 8 ... 9 10 function ClientWindowProc(wnd: HWND; Msg: Cardinal; 11 wParam, lParam: Integer): Integer; stdcall; 12 var 13 f: Pointer; 14 begin 15 f := Pointer(GetWindowLong(wnd, GWL_USERDATA)); 16 17 case Msg of 18 WM_NCCALCSIZE: begin 19 20 if (GetWindowLong(wnd, GWL_STYLE) 21 and (WS_HSCROLL or WS_VSCROLL)) <> 0 then 22 23 SetWindowLong(wnd, GWL_STYLE, 24 GetWindowLong(wnd, GWL_STYLE) and 25 not (WS_HSCROLL or WS_VSCROLL)); 26 end; 27 end; 28 29 Result := 30 CallWindowProc(f, wnd, Msg, wparam, lparam); 31 end; 32 33 procedure TForm1.FormCreate(Sender: TObject); 34 begin 35 if ClientHandle <> 0 then begin 36 37 if (not (GetWindowLong(ClientHandle, 38 GWL_USERDATA) <> 0)) then begin 39 40 SetWindowLong(ClientHandle, GWL_USERDATA, 41 SetWindowLong(ClientHandle, GWL_WNDPROC, 42 Integer(@ClientWindowProc))); 43 end; 44 end; 45 46 // ... 47 end;

Nenhum comentário: