소리소문 없이... 사랑도 명예도 이름도 남김 없이...
DexCore.net

C#

모니터 영역 사이즈 구하기

탑~! 2010. 12. 8. 17:27

C#에서 윈도우즈의 해상도를 가져오는 방법은 다음과 같다.

Screen.PrimaryScreen.Bounds.Width
Screen.PrimaryScreen.Bounds.Height


이를 이용해 폼을 윈도우즈의 정중앙에 띄울수 도 있다.

this.Location = new Point(
Screen.PrimaryScreen.Bounds.Width/2 - this.Size.Width/2,
Screen.PrimaryScreen.Bounds.Height/2 - this.Size.Height/2);


현재 윈도우 해상도 얻기
Size Bounds = Screen.PrimaryScreen.Bounds.Size;
MessageBox.Show(Bounds.ToString());
(결과) Width=2560, Height=1600


작업 표시줄 제외한 윈도우 영역 크기

Size WorkingArea = Screen.PrimaryScreen.WorkingArea.Size;
MessageBox.Show(WorkingArea.ToString());

728x90
반응형

'C#' 카테고리의 다른 글

컨트롤의 속성 그룹화 하기  (0) 2010.12.20
밀리세컨 시간동안 대기  (0) 2010.12.17
wmi 로 하드웨어 정보 읽기  (0) 2010.10.12
Form Handle  (0) 2010.10.12
C# WebCam User Control Source  (0) 2010.09.28