2 ways to realize multi-display and multi-screen display in WinForm program

Source: Internet
Author: User

This article mainly introduced the WinForm window realizes the multi-display display 2 kinds of methods, this article has given the realization code directly, and has made the explanation to some important parameters, needs the friend to be possible the reference.

A host is connected to 2 displays (2 video cards), requiring two forms of a program to be displayed on different monitors: Display 1 shows From1, and monitor 2 shows From2. The code and description are as follows:

Form1 do not need to change the code, FROM2 add the following code:

Method One: From2 frm2 = new From2 (); if (Screen.AllScreens.Count ()! = 1) {  frm2. left = Screen.allscreens[0]. Bounds.width;  Frm2. Top = 0;  Frm2. Size = new System.Drawing.Size (screen.allscreens[1]. Bounds.width, Screen.allscreens[1]. Bounds.height);} Method Two: This   . left = ((Screen.allscreens[1]. Bounds.width-this. Width)/2);   This. Top = ((Screen.allscreens[1]. Bounds.height-this. Height)/2);   This. Size = new System.Drawing.Size (screen.allscreens[1]. Bounds.width, Screen.allscreens[1]. Bounds.height);

Description

Gets 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);

Gets the screen where the current mouse is located: Currentscreen = Screen.frompoint (new Point (cursor.position.x, CURSOR.POSITION.Y));

Source: http://www.jb51.net/article/67263.htm

2 ways to realize multi-display and multi-screen display in WinForm program

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.