Dual screen display 1//with the screen class in WinForm, you can easily implement multiple forms to display on multiple screens, respectively. //• Get the number of screens currently connected to the system: Screen.AllScreens.Count (); //• Gets the name of the current screen: string currentscreenname = Screen.fromcontrol (this). devicename; //• Gets the current screen object: Currentscreen = Screen.fromcontrol (this); //• Get the screen where the current mouse is located: Currentscreen = Screen.frompoint (new Point (cursor.position.x, CURSOR.POSITION.Y)); //• Make the form appear on the 2nd screen://This . left = ((Screen.allscreens[1]. Bounds.width-this. Width)/2); //This . Top = ((Screen.allscreens[1]. Bounds.height-this. Height)/2); Private voidShowonmonitor (intshowonmonitor) {screen[] SC; SC=Screen.allscreens; if(Showonmonitor >=SC. Length) {Showonmonitor=0; } This. FormBorderStyle = Formborderstyle.none;//Borderless Full Screen display This. StartPosition =formstartposition.manual; This. Location =NewPoint (Sc[showonmonitor]. Bounds.left, Sc[showonmonitor]. Bounds.top); //This . Location = new Point ((Sc[showonmonitor). Bounds.width-this.width)/2), ((Sc[showonmonitor). Bounds.height-this.height)/2)); //If you intend the form to being maximized, change it to normal and then maximized. //This . WindowState = Formwindowstate.normal; This. WindowState = formwindowstate.maximized;//Maximize Windowif the Showonmonitor parameter is equal to 0 for the main screen and 1 for the expansion screen when the dual graphics card is connected
Dual screen display 1
Dual screen display 2Private voidShowOnMonitor2 () {screen[] SC; SC=Screen.allscreens; //get all the screen width and heightsForm1 f =NewForm1 (); F.formborderstyle=Formborderstyle.none; F.left= sc[1]. Bounds.width; F.top= sc[1]. Bounds.height; F.startposition=formstartposition.manual; F.location= sc[1]. Bounds.location; Point P=NewPoint (sc[1]. Bounds.location.x, sc[1]. BOUNDS.LOCATION.Y); F.location=p; F.windowstate=formwindowstate.maximized; F.show (); } sc[when accessing dual graphics cards0] Main screen, sc[1] Expansion Screen
Dual screen display 2
Two-screen display of a form This. Location =NewPoint (0,0); Screen[] SC; SC=Screen.allscreens; This. Width = (sc[0]. Bounds.width + sc[1]. Bounds.width);//+20; This. Height = (sc[0]. Bounds.height);//+200; This. FormBorderStyle = Formborderstyle.none;//Border StyleWebbrowser1.width = sc[0]. Bounds.width; Webbrowser1.height= sc[0]. Bounds.height; Webbrowser1.location=NewPoint (sc[0]. Bounds.location.x, sc[0]. BOUNDS.LOCATION.Y); Webbrowser1.url=NewUri ("http://www.google.com.hk"); Webbrowser2.width= sc[1]. Bounds.width; Webbrowser2.height= sc[1]. Bounds.height; Webbrowser2.location=NewPoint (sc[1]. Bounds.location.x, sc[1]. BOUNDS.LOCATION.Y); Webbrowser2.url=NewUri ("http://www.baidu.com");
Two-screen display of a form
Here for knowledge record, Source: http://www.cnblogs.com/zzcong/archive/2012/06/13/2547877.html
C # Winform Dual screen display