IT/Delphi

[델파이] 현재 모니터 구하기 및 폼 전체 화면

pierrot_98 2019. 10. 31. 19:30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
var
  bDisplayFlg : Boolean;
  iAct : Integer;
begin 
  //모니터가 그냥 1개라면 보조 모니터로
  if Screen.MonitorCount = 1 then
    bDisplayFlg := False; 
 
  if bDisplayFlg then 
  begin  
    //주모니터
    //화면 전체크기
    SetBounds(Screen.Monitors[1].Left,Screen.Monitors[1].Top,
              Screen.Monitors[1].Width,Screen.Monitors[1].Height);
  end else
  begin
    //보조모니터 
    //화면 전체크기
    SetBounds(Screen.Monitors[0].Left,Screen.Monitors[0].Top,
              Screen.Monitors[0].Width,Screen.Monitors[0].Height);
  end;
  
////////////////////////////////////////////////////
  //현재 Form이 위치한 화면 크기로..
  iAct := Form.Monitor.MonitorNum;
  SetBounds(Screen.Monitors[iAct ].Left,Screen.Monitors[iAct ].Top,
            Screen.Monitors[iAct ].Width,Screen.Monitors[iAct ].Height);
end;
cs