public void InitializeAndSwitch() { var sm = new vScreen.lib.ScreenManager(4); sm.Switch(1, IntPtr.Zero); WindowUnitTests.Wait(1); sm.Switch(0, IntPtr.Zero); }
public int OpenDialog(vScreen.lib.ScreenManager screenManager) { this._pictureBoxes = DS.List(pictureBox1, pictureBox2, pictureBox3, pictureBox4); this._pictureBoxes.ForEach(pp => pp.BorderStyle = BorderStyle.None); this._screenManager = screenManager; int margin = 4; var foundOneImage = false; for (var i = 0; i < this._screenManager.Count; i++) { var s = this._screenManager[i]; this._pictureBoxes[i].Visible = false; if (s.HasDesktopBitmap) { foundOneImage = true; var p = this._pictureBoxes[i]; p.Tag = i; p.Visible = true; p.Image = Image.FromFile(s.PngFile); p.Width = p.Image.Width; p.Height = p.Image.Height; switch (i) { case 0: p.Left = margin; p.Top = margin; break; case 1: p.Left = p.Width + (2 * margin); p.Top = margin; break; case 2: p.Left = margin; p.Top = p.Height + (2 * margin); break; case 3: p.Left = p.Width + (2 * margin); p.Top = p.Height + (2 * margin); break; } this.Width = p.Width * 2 + margin * 4; this.Height = p.Height * 2 + margin * 8; } } if (!foundOneImage) { return(-1); } this.butCancel.Left = this.Width + 100; // Hide button var r = this.ShowDialog(); if (r == System.Windows.Forms.DialogResult.OK) { return(_selected); } else { return(-1); } }
private void frmVScreen_Load(object sender, EventArgs e) { this.ExecuteCommandLine(); this.Text = "{0}".FormatString(Application.ProductName); vScreen.lib.Screen.AddHandleToIgnore(this.Handle); vScreen.Settings1.Default.Reload(); _buttons.AddRange(DS.List(butScreen1, butScreen2, butScreen3, butScreen4)); this._moveToMenuItems = DS.List(moveTo1ToolStripMenuItem, moveTo2ToolStripMenuItem, moveTo3ToolStripMenuItem, moveTo4ToolStripMenuItem); this.lblCurrentApp.Text = string.Empty; this._taskBar = new lib.Taskbar(); this.Left = Screen.PrimaryScreen.Bounds.Width - this.Width - 3; this.Top = Screen.PrimaryScreen.Bounds.Height - this.Height - 3 - (this._taskBar.Size.Height); ScreenManager = new lib.ScreenManager(MAX_SCREEN); this.butScreen1.Click += new System.EventHandler(this.butScreen_Click); this.butScreen2.Click += new System.EventHandler(this.butScreen_Click); this.butScreen3.Click += new System.EventHandler(this.butScreen_Click); this.butScreen4.Click += new System.EventHandler(this.butScreen_Click); this.butScreen1.MouseLeave += new System.EventHandler(this.butScreen1_MouseLeave); this.butScreen1.MouseEnter += new System.EventHandler(this.butScreen1_MouseEnter); this.butScreen2.MouseLeave += new System.EventHandler(this.butScreen1_MouseLeave); this.butScreen2.MouseEnter += new System.EventHandler(this.butScreen1_MouseEnter); this.butScreen3.MouseLeave += new System.EventHandler(this.butScreen1_MouseLeave); this.butScreen3.MouseEnter += new System.EventHandler(this.butScreen1_MouseEnter); this.butScreen4.MouseLeave += new System.EventHandler(this.butScreen1_MouseLeave); this.butScreen4.MouseEnter += new System.EventHandler(this.butScreen1_MouseEnter); tmrBkTask.Enabled = true; tmrClipboard.Enabled = true; this.InitializeHotKeys(); }