는 가장 좋은 방법은 무엇입하 Delphi 응용 프로그램을 완전히 전체 화면?

StackOverflow https://stackoverflow.com/questions/14451

  •  08-06-2019
  •  | 
  •  

문제

는 가장 좋은 방법은 무엇입하 delphi 응용 프로그램(델파이 2007for win32 여기에서)완전히 전체 화면으로 이동,응용 프로그램을 제거하 국경을 덮고 windows 작업 표시줄?

내가 찾는 것과 비슷하게 즉 않을 쳤을 때 F11.

나는 이 시간을 실행에 대한 옵션을 사용하지 않는 디자인하는 시간에 의해 결정을 내는 좋은 자체입니다.

서에 언급된 대로 받아들이 대답

BorderStyle := bsNone; 

의 일부분이었지 방법이 될 수 있습니다.이상하게 보관을 얻 E2010 Incompatible types: 'TFormBorderStyle' and 'TBackGroundSymbol' 오류가 사용하는 경우는 라인(다른 유형 bsNone 정의).

이것을 극복하기 위하여 나를 사용:

BorderStyle := Forms.bsNone;
도움이 되었습니까?

해결책

만,이것은 항상 나를 위해 일했습니다.비트를 보인다.

procedure TForm52.Button1Click(Sender: TObject);
begin
  BorderStyle := bsNone;
  WindowState := wsMaximized;
end;

다른 팁

Google 검색 설정하는 다음과 같은 추가 방법:

(그러나 내가 생각하고 싶어로 지의 방법 먼저)

수동으로 입력 화면 (from:에 대한 델파이)

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;

이 WinAPI 방법 (피터 아래에서 TeamB)

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; 

을 양식 onShow 이벤트 같은 코드:

  WindowState:=wsMaximized;

OnCanResize 이:

  if (newwidth<width) and (newheight<height) then
    Resize:=false;

을 극대화 및 양식 숨기기 제목 바.최대화 라인에서 수행되는 메모리,하지만 나는 확 WindowState 성을 원합니다.

문서지만,그가 너무 복잡하다.

procedure TForm1.FormCreate(Sender: TObject) ;
begin
   //maximize the window
   WindowState := wsMaximized;
   //hide the title bar
   SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) and not WS_CAPTION);
   ClientHeight := Height;
end;

편집:여기에 완료를 들어,"full screen"및"복"옵션이 있습니다.내가 깨진의 다른 부분으로 작은 절차에 대한 최대의 명확성,그래서이 될 수 있는 것을 찾을 수으로 압축된 단 몇 줄.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    btnGoFullScreen: TButton;
    btnNotFullScreen: TButton;
    btnShowTitleBar: TButton;
    btnHideTitleBar: TButton;
    btnQuit: TButton;
    procedure btnGoFullScreenClick(Sender: TObject);
    procedure btnShowTitleBarClick(Sender: TObject);
    procedure btnHideTitleBarClick(Sender: TObject);
    procedure btnNotFullScreenClick(Sender: TObject);
    procedure btnQuitClick(Sender: TObject);
  private
    SavedLeft : integer;
    SavedTop : integer;
    SavedWidth : integer;
    SavedHeight : integer;
    SavedWindowState : TWindowState;
    procedure FullScreen;
    procedure NotFullScreen;
    procedure SavePosition;
    procedure HideTitleBar;
    procedure ShowTitleBar;
    procedure RestorePosition;
    procedure MaximizeWindow;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btnQuitClick(Sender: TObject);
begin
  Application.Terminate;
end;

procedure TForm1.btnGoFullScreenClick(Sender: TObject);
begin
  FullScreen;
end;

procedure TForm1.btnNotFullScreenClick(Sender: TObject);
begin
  NotFullScreen;
end;

procedure TForm1.btnShowTitleBarClick(Sender: TObject);
begin
  ShowTitleBar;
end;

procedure TForm1.btnHideTitleBarClick(Sender: TObject);
begin
  HideTitleBar;
end;

procedure TForm1.FullScreen;
begin
  SavePosition;
  HideTitleBar;
  MaximizeWindow;
end;

procedure TForm1.HideTitleBar;
begin
  SetWindowLong(Handle,GWL_STYLE,GetWindowLong(Handle,GWL_STYLE) and not WS_CAPTION);
  ClientHeight := Height;
end;

procedure TForm1.MaximizeWindow;
begin
  WindowState := wsMaximized;
end;

procedure TForm1.NotFullScreen;
begin
  RestorePosition;
  ShowTitleBar;
end;

procedure TForm1.RestorePosition;
begin
  //this proc uses what we saved in "SavePosition"
  WindowState := SavedWindowState;
  Top := SavedTop;
  Left := SavedLeft;
  Width := SavedWidth;
  Height := SavedHeight;
end;

procedure TForm1.SavePosition;
begin
  SavedLeft := Left;
  SavedHeight := Height;
  SavedTop := Top;
  SavedWidth := Width;
  SavedWindowState := WindowState;
end;

procedure TForm1.ShowTitleBar;
begin
  SetWindowLong(Handle,gwl_Style,GetWindowLong(Handle,gwl_Style) or ws_Caption or ws_border);
  Height := Height + GetSystemMetrics(SM_CYCAPTION);
  Refresh;
end;

end.

하는 방법을 제한 하위 내에서 형성 Mainform 아 MDI 습니다. 그러나 두통 없이!(주의:답글을 본 페이지에 도움이 이 작업,그래서 그 이유는 게시된 내한 솔루션이 여기)

private
{ Private declarations }
  StickyAt: Word;
  procedure WMWINDOWPOSCHANGING(Var Msg: TWMWINDOWPOSCHANGING); Message M_WINDOWPOSCHANGING;
  Procedure WMGetMinMaxInfo(Var msg: TWMGetMinMaxInfo); message WM_GETMINMAXINFO;

나중에...

    procedure TForm2.WMWINDOWPOSCHANGING(var Msg: TWMWINDOWPOSCHANGING);
    var
      A, B: Integer;
      iFrameSize: Integer;
      iCaptionHeight: Integer;
      iMenuHeight: Integer;
    begin

      iFrameSize := GetSystemMetrics(SM_CYFIXEDFRAME);
      iCaptionHeight := GetSystemMetrics(SM_CYCAPTION);
      iMenuHeight := GetSystemMetrics(SM_CYMENU);

      // inside the Mainform client area
      A := Application.MainForm.Left + iFrameSize;
      B := Application.MainForm.Top + iFrameSize + iCaptionHeight + iMenuHeight;

      with Msg.WindowPos^ do
      begin

        if x <= A + StickyAt then
          x := A;

        if x + cx >= A + Application.MainForm.ClientWidth - StickyAt then
          x := (A + Application.MainForm.ClientWidth) - cx + 1;

       if y <= B + StickyAt then
         y := B;

       if y + cy >= B + Application.MainForm.ClientHeight - StickyAt then
         y := (B + Application.MainForm.ClientHeight) - cy + 1;

      end;
end;

그리고 아직 더 많은...

Procedure TForm2.WMGetMinMaxInfo(Var msg: TWMGetMinMaxInfo);
var
  iFrameSize: Integer;
  iCaptionHeight: Integer;
  iMenuHeight: Integer;
Begin
  inherited;
  iFrameSize := GetSystemMetrics(SM_CYFIXEDFRAME);
  iCaptionHeight := GetSystemMetrics(SM_CYCAPTION);
  iMenuHeight := GetSystemMetrics(SM_CYMENU);
  With msg.MinMaxInfo^.ptMaxPosition Do
  begin
    // position of top when maximised
    X := Application.MainForm.Left + iFrameSize + 1;
    Y := Application.MainForm.Top + iFrameSize + iCaptionHeight + iMenuHeight + 1;
  end;
  With msg.MinMaxInfo^.ptMaxSize Do
  Begin
     // width and height when maximized
     X := Application.MainForm.ClientWidth;
     Y := Application.MainForm.ClientHeight;
  End;
  With msg.MinMaxInfo^.ptMaxTrackSize Do
  Begin
     // maximum size when maximised
     X := Application.MainForm.ClientWidth;
     Y := Application.MainForm.ClientHeight;
  End;
  // to do: minimum size (maybe)
End;

당신이 필요가 있는지 확인 양식에 위치 poDefaultPosOnly.

Form1.Position := poDefaultPosOnly;
Form1.FormStyle := fsStayOnTop;
Form1.BorderStyle := bsNone;
Form1.Left := 0;
Form1.Top := 0;
Form1.Width := Screen.Width;
Form1.Height := Screen.Height;

테스트 및에서 작동합 Win7x64.

Hm.보고에서 응답을 내가 기억하는 것이 다루는 8 년 전에 나는 코드는 게임이다.을 쉽게 디버깅,내가 사용하는 장치의 컨텍스트를 정상적인,델파이의 형태로 소스에 대한 전체 화면 표시됩니다.

는 점,그 DirectX 실행할 수있는 모든 디바이스 컨텍스트 전체 화면-포함하여 할당한의 양식입니다.

그래서 응용 프로그램을 제공하기"true"전능,추적 DirectX 라이브러리에 대한 델파이고 그것은 아마도 포함 무엇이 필요합니다.

나의 케이스에서,유일한 작업 솔루션:

procedure TFormHelper.FullScreenMode;
begin
  BorderStyle := bsNone;
  ShowWindowAsync(Handle, SW_MAXIMIZE);
end;

Try:

Align = alClient    
FormStyle = fsStayOnTop

이것은 항상 정렬 기본 모니터링;

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top