private void CloseButton_Click(object sender, RoutedEventArgs e) { var panel = Parent as Panel; panel?.Children.Remove(this); CloseClick?.Invoke(this); }
/// <summary>Closes the form.</summary> /// <param name="form">The form.</param> public void CloseForm(Form form) { if (form == null) { form = ParentForm; } CloseClick?.Invoke(new ControlBoxEventArgs(form)); form.Close(); }
protected override void OnMouseUp(MouseEventArgs e) { if (CloseButtonPressed && IsHighlighted() && e.Button == MouseButtons.Left) { // raise close event. if (CloseClick != null) { CloseClick.Invoke(this, new EventArgs()); } } else { base.OnMouseUp(e); } CloseButtonPressed = false; }
/// <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; } } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); bIsMouseDown = false; m_WndMove = false; if (bIsMouseOverClose) { Hide(); CloseClick?.Invoke(this, new EventArgs()); } else if (bIsMouseOverTitle) { TitleClick?.Invoke(this, new EventArgs()); } else if (bIsMouseOverContent) { ContentClick?.Invoke(this, new EventArgs()); } }
protected virtual void OnCloseClick(object sender, EventArgs e) { if (!DesignMode) { Button btnClose = (Button)sender; TabPage tpCurrent = DocumentButtons[btnClose]; CancelEventArgs cea = new CancelEventArgs(); CloseClick?.Invoke(sender, cea); if (!cea.Cancel) { TabPages.Remove(tpCurrent); tpCurrent.Dispose(); btnClose.Dispose(); Repos(); if (TabPages.Count == 0) { Visible = false; } } } }
private void btnClose_Click(object sender, EventArgs e) { CloseClick?.Invoke(sender, e); }
private void CloseButtonClick(object sender, RoutedEventArgs e) { Hide(); CloseClick?.Invoke(sender, e); }
/// <summary>The OnCloseClick.</summary> /// <param name="sender">The sender.</param> /// <param name="e">The event args.</param> protected virtual void OnCloseClick(object sender, EventArgs e) { CloseClick?.Invoke(new ControlBoxEventArgs(ParentForm)); ParentForm.Close(); }
private void btnClose_Click() => CloseClick?.Invoke();
public PmNodeContextMenu() { Items.Add("Close").Click += delegate { CloseClick.Fire(this, EventArgs.Empty); }; }
private void OnCloseButtonClick() { CloseClick?.Invoke(); }
private void KeyDown_MouseDown(object sender, MouseEventArgs e) { if (sender is Label lbl) { if (string.IsNullOrEmpty(lbl.Text)) { return; } //切换大写 if (lbl.Text == "CAP") { ToUpperOrLower(this, true); lbl.Text = "cap"; } //切换小写 else if (lbl.Text == "cap") { ToUpperOrLower(this, false); lbl.Text = "CAP"; } //切换字符或数字 else if (lbl.Text == "?123" || lbl.Text == "abc.") { ChangeShow(this); } else if (lbl.Text == "空格") { SendKeys.Send(" "); } else if (lbl.Text.ToLower() == "shift") { SendKeys.Send("+"); if (lbl.Text == "shift") { lbl.Text = "SHIFT"; } else { lbl.Text = "shift"; } } else if (lbl.Text == "删除") { SendKeys.Send("{BACKSPACE}"); BackspaceClick?.Invoke(sender, e); } else if (lbl.Text == "回车") { SendKeys.Send("{ENTER}"); EnterClick?.Invoke(sender, e); } else if (lbl.Text == "关闭") { CloseClick?.Invoke(this, e); } else { string str = "{" + lbl.Text + "}"; SendKeys.Send(str); KeyClick?.Invoke(sender, e); } } }
protected virtual void btnClose_Click(object sender, EventArgs e) { CloseClick?.Invoke(sender, e); }