private void CreateMirrorForm() { Screen[] screens = Screen.AllScreens; _mirroredForm = new MirroredForm(this); _mirroredForm.WindowState = FormWindowState.Normal; _mirroredForm.StartPosition = FormStartPosition.Manual; _mirroredForm.Location = screens[_defaultMirrorIndex - 1].WorkingArea.Location; _mirroredForm.Size = screens[_defaultMirrorIndex - 1].Bounds.Size; }
public void StopMirroring() { try { if (_mirrorState.SelectedProcess?.ProcessName.ToLower() != "iexplore") { Thread.Sleep(200); } timer1.Stop(); _mirrorState.Active = false; _itemStop.Enabled = false; _mirrorState.SelectedProcess = null; if (_mirroredForm == null) { return; } if (_mirroredForm.InvokeRequired) { _mirroredForm.Invoke((Action)(() => { _mirroredForm.Close(); _mirroredForm = null; notifyIcon1.Icon = Properties.Resources.notifiyicon; })); } else { _mirroredForm.Close(); _mirroredForm = null; notifyIcon1.Icon = Properties.Resources.notifiyicon; } //_pinBtnForm.Close(); //CreatePinBtnForm(); GC.Collect(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); Application.Exit(); } }