public void Highlight() { lock (this.formLock) { this.Opacity = 0.8D; } //this.BringToFront(); //this.TopMost = true; this.Show(); WindowInfoWithHandle.SetWindowForground(this.Handle); for (int i = 20; i >= 0; i--) { //フォームの不透明度を変更する lock (this.formLock) { this.Opacity = 0.05 * i; } //一時停止 System.Threading.Thread.Sleep(1); //await Task.Delay(30); } this.Hide(); this.Close(); }
/** * <summary> * ウィンドウ情報をデバッグ用に出力する * </summary> */ public static void DebugWindowInfo(string message, WindowInfoWithHandle windowInfoWithHandle) { var windowHandle = windowInfoWithHandle.windowHandle; var windowTitle = windowInfoWithHandle.windowTitle; var monitorHandle = windowInfoWithHandle.GetMonitorHandle(); var m = message + $" : {windowTitle} ( hWnd={windowHandle}, hMonitor={monitorHandle} )"; Logger.WriteLine(m); }
/** * <summary> * コンテキストメニューを表示する * </summary> */ public void ShowContextMenu() { var monitorInfo = this.monitorManager.GetCurrentMonitor(); System.Drawing.Point p = new System.Drawing.Point(); p.X = monitorInfo.monitorRect.left + 100; p.Y = monitorInfo.monitorRect.top + 100; this.contextMenuStrip1.Show(p); WindowInfoWithHandle.SetWindowForground(this.contextMenuStrip1.Handle); //this.contextMenuStrip1.Focus(); }
/** * <summary> * WindowInfoWithHandle をモニターの WindowManager から削除する * </summary> */ public WindowManager RemoveWindowInfo(WindowInfoWithHandle windowInfoWithHandle) { // このウィンドウのモニターのウィンドウを管理する WindowManager が存在すれば // これに追加して管理させる var targetWindowManager = this.FindWindowManagerByMonitorHandle(windowInfoWithHandle.GetMonitorHandle()); if (targetWindowManager is null) { return(this.windowManagers.ElementAt(0)); } Logger.DebugWindowManager("windowManager of MonitorManager.RemoveWindowInfo", targetWindowManager); Logger.DebugWindowInfo("windowInfo of MonitorManager.RemoveWindowInfo", windowInfoWithHandle); targetWindowManager.Remove(windowInfoWithHandle); return(targetWindowManager); }
/** * <summary> * WindowInfoWithHandle をカレントモニター、カレントウィンドウにする * </summary> */ public void ActivateWindowInfo(WindowInfoWithHandle windowInfoWithHandle) { var monitorHandle = windowInfoWithHandle.GetMonitorHandle(); var targetWindowManager = this.FindWindowManagerByMonitorHandle(monitorHandle); if (targetWindowManager == null) { return; } Logger.DebugWindowManager("windowManager of MonitorManager.ActivateWindowInfo", targetWindowManager); Logger.DebugWindowInfo("windowInfo of MonitorManager.ActivateWindowInfo", windowInfoWithHandle); this.SetCurrentWindowManagerIndexByMonitorHandle(monitorHandle); targetWindowManager.SetCurrentWindowIndexByWindowInfo(windowInfoWithHandle); return; }
protected WindowInfoWithHandle LaunchSampleApplication() { var proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = @"c:\Windows\System32\notepad.exe"; proc.Start(); proc.WaitForInputIdle(); proc.Refresh(); //Debug.WriteLine(proc.MainWindowHandle); var windowInfoWithHandle = new WindowInfoWithHandle(proc.MainWindowHandle); return(windowInfoWithHandle); }
/** * <summary> * WindowInfoWithHandle をモニターのWindowManagerの先頭に追加する * </summary> */ public WindowManager PushWindowInfo(WindowInfoWithHandle windowInfoWithHandle) { // このウィンドウのモニターのウィンドウを管理する WindowManager が存在すれば // これに追加して管理させる var monitorHandle = windowInfoWithHandle.GetMonitorHandle(); var targetWindowManager = this.FindWindowManagerByMonitorHandle(monitorHandle); if (targetWindowManager is null) { return(this.GetCurrentMonitorWindowManager()); } Logger.DebugWindowManager("windowManager of MonitorManager.PushWindowInfo", targetWindowManager); Logger.DebugWindowInfo("windowInfo of MonitorManager.PushWindowInfo", windowInfoWithHandle); this.SetCurrentWindowManagerIndexByMonitorHandle(monitorHandle); targetWindowManager.Push(windowInfoWithHandle); return(targetWindowManager); }
protected bool ExistsWindow(WindowInfoWithHandle wiwh) { return(IsWindowVisible(wiwh.windowHandle)); }