public string ToTooltipString() { if (Key == KeyCode.None && MouseButton == MouseButtonEnum.None) { return(string.Empty); } List <string> s = new List <string>(); if (Control) { s.Add("Ctrl"); } if (Alt) { s.Add("Alt"); } if (Shift) { s.Add("Shift"); } if (Command) { s.Add("Cmd"); } string res = string.Join("-", s.ToArray()); if (res.Length > 0) { res += "-"; } if (Key != KeyCode.None) { return("(" + res + Key.ToString() + ")"); } else { return("(" + res + MouseButton.ToString() + ")"); } }
/// <summary> Кнопка мыши была отжата. </summary> /// <param name="right">false - левая, true - правая.</param> public static bool MouseWasReleased(MouseButtonEnum mouseButton = MouseButtonEnum.LeftButton) { if (CursorOut || blockNextInput) { return(false); } switch (mouseButton) { case MouseButtonEnum.LeftButton: return(newMouse.LeftButton == ButtonState.Released && oldMouse.LeftButton == ButtonState.Pressed); case MouseButtonEnum.MiddleButton: return(newMouse.MiddleButton == ButtonState.Released && oldMouse.MiddleButton == ButtonState.Pressed); case MouseButtonEnum.RightButton: return(newMouse.RightButton == ButtonState.Released && oldMouse.RightButton == ButtonState.Pressed); default: throw new Exception("Missing '" + mouseButton.ToString() + "' to input."); } }