protected void Highlight(HighLighterMode mode, int param) { Rectangle rectangle = new Rectangle(); if (mode == HighLighterMode.Screen) { rectangle.X = Screen.AllScreens[param].Bounds.Left + (Properties.BorderBuffer + Properties.BorderWidth); rectangle.Y = Screen.AllScreens[param].Bounds.Top + (Properties.BorderBuffer + Properties.BorderWidth); rectangle.Height = Screen.AllScreens[param].Bounds.Height - (Properties.BorderBuffer + Properties.BorderWidth) * 2; rectangle.Width = Screen.AllScreens[param].Bounds.Width - (Properties.BorderBuffer + Properties.BorderWidth) * 2; } else if (mode == HighLighterMode.Process) { Process proc = Process.GetProcessById(param); IntPtr windowHandle = proc.MainWindowHandle; rectangle = GetWindowRectangle(windowHandle); } else if (mode == HighLighterMode.Window) { IntPtr windowHandle = new IntPtr(param); rectangle = GetWindowRectangle(windowHandle); } SetLocation(rectangle); }
/// <summary> /// Initializes the Highlighter class, with the given properties. /// </summary> /// <param name="properties">The properties to use for highlighting.</param> public Highlighter(HighLighterMode mode, int param, HighlighterProperties properties) { this._mode = mode; this._param = param; this._disposed = false; this._properties = properties; this.BackColor = this._properties.Color; this.ForeColor = System.Drawing.Color.Black; this.FormBorderStyle = FormBorderStyle.None; this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "Highlighter Window"; this.ShowInTaskbar = false; this.StartPosition = FormStartPosition.Manual; this.Text = this.Name; this.TopMost = true; }
/// <summary> /// Initializes the Highlighter class. /// </summary> public Highlighter(HighLighterMode mode, int param) : this(mode, param, HighlighterProperties.Default) { }