System.Windows.Forms.RibbonCaptionButton.OnClick C# (CSharp) Method

OnClick() public method

public OnClick ( EventArgs e ) : void
e EventArgs
return void
      public override void OnClick(EventArgs e)
        {
            base.OnClick(e);

            Form f = Owner.FindForm();

            if (f == null) return;

            switch (CaptionButtonType)
            {
                case CaptionButton.Minimize:
                    f.WindowState = FormWindowState.Minimized;
                    break;
                case CaptionButton.Maximize:
                    if (f.WindowState == FormWindowState.Normal)
                    {
                       f.WindowState = FormWindowState.Maximized;
                       f.Refresh();
                    }
                    else
                    {
                       f.WindowState = FormWindowState.Normal;
                       f.Refresh();
                    }
                    break;
                case CaptionButton.Restore:
                    f.WindowState = FormWindowState.Normal;
                    break;
                case CaptionButton.Close:
                    f.Close();
                    break;
                default:
                    break;
            }
        }