嗯,这一直对我有用.看起来有点简单......
procedure TForm52.Button1Click(Sender: TObject); begin BorderStyle := bsNone; WindowState := wsMaximized; end;
谷歌搜索发现以下其他方法:
(虽然我想我先尝试罗迪的方法)
procedure TSomeForm.FormShow(Sender: TObject) ; var r : TRect; begin Borderstyle := bsNone; SystemParametersInfo (SPI_GETWORKAREA, 0, @r,0) ; SetBounds (r.Left, r.Top, r.Right-r.Left, r.Bottom-r.Top) ; end;
FormStyle := fsStayOnTop; BorderStyle := bsNone; Left := 0; Top := 0; Width := Screen.Width; Height := Screen.Height;
private // in form declaration Procedure WMGetMinMaxInfo(Var msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO; Procedure TForm1.WMGetMinMaxInfo(Var msg: TWMGetMinMaxInfo); Begin inherited; With msg.MinMaxInfo^.ptMaxTrackSize Do Begin X := GetDeviceCaps( Canvas.handle, HORZRES ) + (Width - ClientWidth); Y := GetDeviceCaps( Canvas.handle, VERTRES ) + (Height - ClientHeight ); End; End; procedure TForm1.Button2Click(Sender: TObject); Const Rect: TRect = (Left:0; Top:0; Right:0; Bottom:0); FullScreen: Boolean = False; begin FullScreen := not FullScreen; If FullScreen Then Begin Rect := BoundsRect; SetBounds( Left - ClientOrigin.X, Top - ClientOrigin.Y, GetDeviceCaps( Canvas.handle, HORZRES ) + (Width - ClientWidth), GetDeviceCaps( Canvas.handle, VERTRES ) + (Height - ClientHeight )); // Label2.caption := IntToStr(GetDeviceCaps( Canvas.handle, VERTRES )); End Else BoundsRect := Rect; end;