ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/EmuXPortal/trunk/EmuXPortal/Api/DisplayHelper.cs
Revision: 13
Committed: Tue Apr 3 21:00:28 2012 UTC (10 years, 10 months ago) by william
File size: 1006 byte(s)
Log Message:
setup config to move form to proper screen at start

File Contents

# User Rev Content
1 william 13 using System;
2     using System.Collections.Generic;
3     using System.Linq;
4     using System.Text;
5     using System.Windows.Forms;
6    
7     namespace EmuXPortal.Api
8     {
9     public class DisplayHelper
10     {
11     public DisplayHelper() : this(Screen.PrimaryScreen) { }
12     public DisplayHelper(string device) : this(GetScreenFromString(device)) { }
13     public DisplayHelper(Screen device)
14     {
15     PhysicalDisplayDevice = device;
16     }
17     #region GetScreenFromString
18     private static Screen GetScreenFromString(string device)
19     {
20     Screen scn = Screen.PrimaryScreen;
21     foreach (Screen screen in Screen.AllScreens) { if (screen.DeviceName.ToLower() == device.ToLower()) { scn = screen; break; } }
22     return scn;
23     }
24     #endregion
25     private Screen _PhysicalDisplayDevice;
26     public Screen PhysicalDisplayDevice { get { return _PhysicalDisplayDevice; } private set { _PhysicalDisplayDevice = value; } }
27     }
28     }