private void ToggleManipulateWindow(KeyStates inKeyStates) { /* None -> Down, Down -> None : 改變可操縱視窗狀態並保存目前狀態,視窗可移動時將停止伺服器訪問以增進使用者體驗 * None -> None, Down -> Down : 不做任何事 */ if (inKeyStates != gKeyStates) // 狀態改變則致能 { canManipulateWindow = (canManipulateWindow) ? false : true; WindowsServices.SetWindowExTransparent(hwnd); gKeyStates = inKeyStates; if (canManipulateWindow) { MainTimer.Stop(); } else { MainTimer.Start(); } } }
protected override void OnSourceInitialized(EventArgs e) { base.OnSourceInitialized(e); hwnd = new WindowInteropHelper(this).Handle; WindowsServices.SetOriStyle(hwnd); }