wpf dual monitor
程序员文章站
2022-07-02 12:54:15
public partial class App : System.Windows.Application { protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); SetupWindow... ......
public partial class app : system.windows.application { protected override void onstartup(startupeventargs e) { base.onstartup(e); setupwindows(); } private void setupwindows() { system.windows.forms.screen mainscreen = screen.allscreens[0]; ; winleft leftwin = new winleft() { windowstartuplocation = windowstartuplocation.manual, windowstate = system.windows.windowstate.normal, left = mainscreen.workingarea.left, top = mainscreen.workingarea.top, width = mainscreen.workingarea.width, height = mainscreen.workingarea.height }; system.windows.forms.screen secondaryscreen = screen.allscreens[1]; winright rightwin = new winright() { windowstartuplocation = windowstartuplocation.manual, windowstate = system.windows.windowstate.normal, left = secondaryscreen.workingarea.left, top = secondaryscreen.workingarea.top, width = secondaryscreen.workingarea.width, height = secondaryscreen.workingarea.height }; leftwin.show(); leftwin.windowstate = windowstate.maximized; rightwin.show(); rightwin.windowstate = windowstate.maximized; rightwin.owner = leftwin; } }