예제 #1
0
        private void CloseButton_Click(object sender, RoutedEventArgs e)
        {
            var panel = Parent as Panel;

            panel?.Children.Remove(this);
            CloseClick?.Invoke(this);
        }
예제 #2
0
        /// <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();
        }
예제 #3
0
 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;
 }
예제 #4
0
 /// <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;
         }
     }
 }
예제 #5
0
        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());
            }
        }
예제 #6
0
        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;
                    }
                }
            }
        }
예제 #7
0
 private void btnClose_Click(object sender, EventArgs e)
 {
     CloseClick?.Invoke(sender, e);
 }
예제 #8
0
 private void CloseButtonClick(object sender, RoutedEventArgs e)
 {
     Hide();
     CloseClick?.Invoke(sender, e);
 }
예제 #9
0
 /// <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();
 }
예제 #10
0
 private void btnClose_Click() => CloseClick?.Invoke();
예제 #11
0
 public PmNodeContextMenu()
 {
     Items.Add("Close").Click += delegate { CloseClick.Fire(this, EventArgs.Empty); };
 }
예제 #12
0
 private void OnCloseButtonClick()
 {
     CloseClick?.Invoke();
 }
예제 #13
0
 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);
         }
     }
 }
예제 #14
0
 protected virtual void btnClose_Click(object sender, EventArgs e)
 {
     CloseClick?.Invoke(sender, e);
 }