본문 바로가기
.Net/WPF

C#/WPF MainWindow Dual monitor setup

by Cum 2022. 9. 16.
728x90
반응형

듀얼모니터 사용시 프로그램 화면 설정

 

MonitorCount 가 2 이상이면 설정가능

 

아래의 배열로 설정가능

AllScreens[0] 

AllScreens[1]

if (System.Windows.Forms.SystemInformation.MonitorCount > 1)
{
    System.Drawing.Rectangle secondaryScreenRectangle = System.Windows.Forms.Screen.AllScreens[0].WorkingArea;

    Window w = sender as Window;

    w.WindowState = WindowState.Normal;
    w.WindowStyle = WindowStyle.None;
    w.WindowStartupLocation = WindowStartupLocation.Manual;
    w.Left = secondaryScreenRectangle.Left;
    w.Top = secondaryScreenRectangle.Top;
    w.Width = secondaryScreenRectangle.Width;
    w.Height = secondaryScreenRectangle.Height;
    w.Show();
    w.WindowState = WindowState.Maximized;
}

 

728x90
반응형

'.Net > WPF' 카테고리의 다른 글

.NetCore 배포 폴더 만들기  (0) 2023.06.12
C# WPF Serial 통신 연결  (0) 2022.09.27

댓글