コード例 #1
0
        /// <summary>The OnMaximizeClick.</summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The event args.</param>
        protected virtual void OnMaximizeClick(object sender, EventArgs e)
        {
            if (ParentForm.WindowState == FormWindowState.Normal)
            {
                if (_maximizeButton.BoxType == ControlBoxButton.ControlBoxType.Default)
                {
                    _maximizeButton.Text = @"2";
                }

                ParentForm.WindowState = FormWindowState.Maximized;
                MaximizeClick?.Invoke(new ControlBoxEventArgs(ParentForm));
            }
            else
            {
                if (_maximizeButton.BoxType == ControlBoxButton.ControlBoxType.Default)
                {
                    _maximizeButton.Text = @"1";
                }

                ParentForm.WindowState = FormWindowState.Normal;
                RestoredFormWindow?.Invoke(new ControlBoxEventArgs(ParentForm));
            }
        }
コード例 #2
0
 /// <summary>The maximize button click.</summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The event args.</param>
 protected virtual void OnMaximizeClick(object sender, EventArgs e)
 {
     MaximizeClick?.Invoke(new ControlBoxEventArgs(ParentForm));
     ToggleWindowState(null);
 }