[Aaronyang] to their own WPF4.5 lost the first ancient cheats [multi-expansion display programming]

Source: Internet
Author: User
Tags home screen

There is
only one person in the world who can't get through, no way--aaronyang's blog (www.ayjs.net)-www.8mi.me

============= two years later to see WPF, some cheats are not suitable for public, public is not valuable, try to ==========

Everyone great website please do not reprint, blog Park has the right to pursue legal responsibility, please respect the work of others, thank you. Everyone read friends, please visit my blog website to view my blog, do not go to other people's website to see

============================================================

Requirements: such as a host, open 4 forms, outside the 3 monitors, click the program button, directly the other 3 forms, respectively, to maximize the display on the other display

Roughly wrong impression, but can learn the principle:

Today's needs:

Wrong idea:

Get the Display object, and then show in this display, hey ~aaronyang tell you, this is a no return!

Correct thinking Steps:

1. As long as you understand all the screen expansion, it will be a large screen, each screen is an object, according to this object can get the information of each monitor

2. Each extended display has a workarea area

3. Place the show time of window equal to the position of the monitor

4. Turn off all screen projection displays, just temporarily remember the window and loop close to

3 Forms, one home screen form, for manipulating

Core code:

screen[] Screens =Screen.allscreens; if(screens. Length = =1) {lblmsg. Content="1 displays have been projected"; }            Else if(screens. Length = =2) {lblmsg. Content="2 displays have been projected"; }            Else if(screens. Length = =4) {lblmsg. Content="4 displays have been projected"; }            Else{lblmsg. Content="currently only supports 1,2,4 display modes"; }            //Home Screen DisplayScreen Mainscreen = screens. FirstOrDefault (x=>x.primary==true); //Home Screen Display Window1Window1 win1 =NewWindow1 (); Win1. WindowState=windowstate.maximized; Win1. Windowstartuplocation=windowstartuplocation.manual; System.Drawing.Rectangle Mswa=Mainscreen.workingarea; Win1. Left=Mswa.            Left; Win1. Top=Mswa.            Top; Win1. Width=Mswa.            Width; Win1. Height=Mswa.            Height;            Openwindows.add (win1); Win1.            Show (); //other screens are shown here, assuming there are 2            varSubscreen = ( fromOinchScreenswhereO.primary = =false SelectO). Tolist<screen>(); if(Subscreen.count >0) {                varSubscreen1 = subscreen[0]; Window2 win2=NewWindow2 (); Win1. WindowState=windowstate.maximized; Win1. Windowstartuplocation=windowstartuplocation.manual; System.Drawing.Rectangle MSWA2=Subscreen1.                Workingarea; Win2. Left=mswa2.                Left; Win2. Top=mswa2.                Top; Win2. Width=mswa2.                Width; Win2. Height=mswa2.                Height;                Openwindows.add (win2); Win2.            Show (); }           

Demo Download: Address: Http://pan.baidu.com/s/1gdrJUSF key: Q9r0

Use case: KFC cashier system, one side to the customer to see, one side to the cashier to see. Catering fee system, Internet Bar system, etc.

Please do not reprint the great website, the blog Park has the right to pursue legal responsibility, please respect the results of other people's work, thank you

====== Anhui Liuan =========www.ayjs.net==========aaronyang======== Yang Yang ========www.8mi.me==========

[Aaronyang] to their own WPF4.5 lost the first ancient cheats [multi-expansion display programming]

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.