/// <summary> /// The basic Timermethod to re- draw and gather new data like the Chatbox- strings. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void tmrRefreshGraphic_Tick(object sender, EventArgs e) { //_swMainWatch.Reset(); //_swMainWatch.Start(); Invalidate(); //_swMainWatch.Stop(); //Debug.WriteLine("Time to Invalidate:" + 1000000 * _swMainWatch.ElapsedTicks / Stopwatch.Frequency + " µs"); if (HelpFunctions.HotkeysPressed(PSettings.PreferenceAll.Global.ChangeSizeAndPosition)) SetWindowStyle = CustomWindowStyles.Clickable; else if (FormBorderStyle != FormBorderStyle.None) SetWindowStyle = CustomWindowStyles.Clickable; else SetWindowStyle = CustomWindowStyles.NotClickable; ChangeWindowStyle(); GetKeyboardInput(); AdjustPanelPosition(); AdjustPanelSize(); /* Refresh Top- Most */ if ( PSc2Process != null && PSc2Process.ProcessName.Length > 0 && Interop.GetForegroundWindow().Equals(PSc2Process.MainWindowHandle)) { if ((DateTime.Now - DtBegin).Seconds > 1) { RefreshForeground(Handle); DtBegin = DateTime.Now; } } //_swMainWatch.Stop(); //Debug.WriteLine("Time to Iterate the timer:" + 1000000 * _swMainWatch.ElapsedTicks / Stopwatch.Frequency + " µs"); }
public static void SetWindowStyle(IntPtr handle, CustomWindowStyles wndStyle) { if (wndStyle.Equals(CustomWindowStyles.Clickable)) { var initial = Interop.GetWindowLong(handle, (Int32)Interop.Gwl.ExStyle); Interop.SetWindowLong(handle, (Int32)Interop.Gwl.ExStyle, (IntPtr)(initial & ~(Int32)Interop.Ws.ExTransparent)); } else if (wndStyle.Equals(CustomWindowStyles.NotClickable)) { var initial = Interop.GetWindowLong(handle, (Int32)Interop.Gwl.ExStyle); Interop.SetWindowLong(handle, (Int32)Interop.Gwl.ExStyle, (IntPtr)(initial | (Int32)Interop.Ws.ExTransparent)); } }