您的位置:首页 > 编程语言 > Delphi

Delphi 去掉MDI窗口的滚动条

2013-06-24 13:56 441 查看
在MDI主窗体中如下代码:

Function ClientWindowProc( wnd: HWND; msg: Cardinal; wparam, lparam: Integer ): Integer; stdcall; 
Var 
pUserdata: Pointer; 
Begin 
pUserdata:= 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(pUserdata, wnd, msg, wparam, lparam ); 
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
// ShowScrollBar(mainform.clienthandle, SB_BOTH, false ); 
If ClientHandle <> 0 Then Begin
If GetWindowLong( ClientHandle, GWL_USERDATA ) <> 0 Then Exit; 
// 加上回调句柄 
SetWindowLong( ClientHandle, GWL_USERDATA, SetWindowLong( ClientHandle, GWL_WNDPROC, integer( @ClientWindowProc))); 
End;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: