/// <summary> /// Update form to display hover styles when the mouse moves over the notification form. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PopupNotifierForm_MouseMove(object sender, MouseEventArgs e) { if (Parent.ShowCloseButton) { mouseOnClose = RectClose.Contains(e.X, e.Y); } if (Parent.ShowOptionsButton) { mouseOnOptions = RectOptions.Contains(e.X, e.Y); } mouseOnLink = RectContentText.Contains(e.X, e.Y); Invalidate(); }
/// <summary> /// A mouse button has been released, check if something has been clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PopupNotifierForm_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (RectClose.Contains(e.X, e.Y)) { CloseClick?.Invoke(this, EventArgs.Empty); } if (RectContentText.Contains(e.X, e.Y)) { LinkClick?.Invoke(this, EventArgs.Empty); } if (RectOptions.Contains(e.X, e.Y) && (Parent.OptionsMenu != null)) { ContextMenuOpened?.Invoke(this, EventArgs.Empty); Parent.OptionsMenu.Show(this, new Point(RectOptions.Right - Parent.OptionsMenu.Width, RectOptions.Bottom)); Parent.OptionsMenu.Closed += OptionsMenu_Closed; } } }
/// <summary> /// A mouse button has been released, check if something has been clicked. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PopupNotifierForm_MouseUp(object sender, MouseEventArgs e) { if (e.Button == System.Windows.Forms.MouseButtons.Left) { if (RectClose.Contains(e.X, e.Y) && (CloseClick != null)) { CloseClick(this, EventArgs.Empty); } if (RectContentText.Contains(e.X, e.Y) && (LinkClick != null)) { LinkClick(this, EventArgs.Empty); } if (RectOptions.Contains(e.X, e.Y) && (Parent.OptionsMenu != null)) { if (ContextMenuOpened != null) { ContextMenuOpened(this, EventArgs.Empty); } Parent.OptionsMenu.Show(this, new Point(RectOptions.Right - Parent.OptionsMenu.Width, RectOptions.Bottom)); Parent.OptionsMenu.Closed += new ToolStripDropDownClosedEventHandler(OptionsMenu_Closed); } } }