/// <summary> /// Make sure your foreground window checker is running. /// </summary> public bool CanTrigger(bool isMouseButtonDown, int x, int y, MouseButtons button, ModifierKey modifiers) { //button/modifier check /* System.Diagnostics.Debug.WriteLine(this.triggeredBy.ToString () + ": "+isMouseButtonDown.ToString()+", " + * "Source - " + button.ToString() + " Dest - " +( (MouseButtons)vk).ToString() * );*/ if (this.vk == (int)button && this.modifiers == modifiers) { //foreground name check // System.Diagnostics.Debug.WriteLine(WindowMonitor.ForegroundProcessName); if (processName.Contains(WindowMonitor.ForegroundProcessName)) { //foreground rect check Point fgLoc = WindowMonitor.GetWindowLocation(); x -= fgLoc.X; y -= fgLoc.Y; } else if (processName.Any()) { return(false); } //so we just checked the name. the name was non null. this means it wasnt the universal identifier, so we return false. /* System.Diagnostics.Debug.WriteLine( * "Point: " + x + " " + y + " -- " + winRect.ToString() * * );*/ if (winRect != Rectangle.Empty && !winRect.Contains(x, y)) { return(false); } //mouse check heh Aids Enjoi! if (isMouseButtonDown) { return(this.triggeredBy == TriggerType.MouseDown); } else { return(this.triggeredBy == TriggerType.MouseUp); } } else { return(false); } }
public DialogResult ShowDialog(IEnumerable <string> procName, Rectangle?target) { if (procName != null) { BaseLocation = WindowMonitor.GetWindowLocation(procName.ToArray()).GetValueOrDefault(Point.Empty); } else { BaseLocation = Point.Empty; } tmpRect = target; var result = ShowDialog(); return(result); }
private void frmOSD_MouseUp(object sender, MouseEventArgs e) { if (_locked) { return; } if (e.Button == MouseButtons.Left) { mouseDown = false; Point?_targetPos = WindowMonitor.GetWindowLocation(_followTarget); if (_targetPos.HasValue) { settings._opOsdPoint = new Point( this.DesktopLocation.X - _targetPos.Value.X, this.DesktopLocation.Y - _targetPos.Value.Y); } } }