Inheritance: System.Windows.Forms.Button, IMetroControl
Beispiel #1
0
 // Token: 0x060003D7 RID: 983 RVA: 0x0000D11C File Offset: 0x0000B31C
 private void WindowButton_Click(object sender, EventArgs e)
 {
     MetroForm.MetroFormButton metroFormButton = sender as MetroForm.MetroFormButton;
     if (metroFormButton != null)
     {
         MetroForm.WindowButtons windowButtons = (MetroForm.WindowButtons)metroFormButton.Tag;
         if (windowButtons == MetroForm.WindowButtons.Close)
         {
             base.Close();
             return;
         }
         if (windowButtons == MetroForm.WindowButtons.Minimize)
         {
             base.WindowState = FormWindowState.Minimized;
             return;
         }
         if (windowButtons == MetroForm.WindowButtons.Maximize)
         {
             if (base.WindowState == FormWindowState.Normal)
             {
                 base.WindowState     = FormWindowState.Maximized;
                 metroFormButton.Text = "2";
                 return;
             }
             base.WindowState     = FormWindowState.Normal;
             metroFormButton.Text = "1";
         }
     }
 }
Beispiel #2
0
        // Token: 0x060003D8 RID: 984 RVA: 0x0000D188 File Offset: 0x0000B388
        private void UpdateWindowButtonPosition()
        {
            if (!base.ControlBox)
            {
                return;
            }
            Dictionary <int, MetroForm.WindowButtons> dictionary = new Dictionary <int, MetroForm.WindowButtons>(3)
            {
                {
                    0,
                    MetroForm.WindowButtons.Close
                },
                {
                    1,
                    MetroForm.WindowButtons.Maximize
                },
                {
                    2,
                    MetroForm.WindowButtons.Minimize
                }
            };
            Point location = new Point(base.ClientRectangle.Width - 5 - 25, 5);
            int   num      = location.X - 25;

            MetroForm.MetroFormButton metroFormButton = null;
            if (this.windowButtonList.Count == 1)
            {
                using (Dictionary <MetroForm.WindowButtons, MetroForm.MetroFormButton> .Enumerator enumerator = this.windowButtonList.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        KeyValuePair <MetroForm.WindowButtons, MetroForm.MetroFormButton> keyValuePair = enumerator.Current;
                        keyValuePair.Value.Location = location;
                    }
                    goto IL_134;
                }
            }
            foreach (KeyValuePair <int, MetroForm.WindowButtons> keyValuePair2 in dictionary)
            {
                bool flag = this.windowButtonList.ContainsKey(keyValuePair2.Value);
                if (metroFormButton == null && flag)
                {
                    metroFormButton          = this.windowButtonList[keyValuePair2.Value];
                    metroFormButton.Location = location;
                }
                else if (metroFormButton != null && flag)
                {
                    this.windowButtonList[keyValuePair2.Value].Location = new Point(num, 5);
                    num -= 25;
                }
            }
IL_134:
            this.Refresh();
        }
Beispiel #3
0
 // Token: 0x060003D6 RID: 982 RVA: 0x0000D054 File Offset: 0x0000B254
 private void AddWindowButton(MetroForm.WindowButtons button)
 {
     if (this.windowButtonList == null)
     {
         this.windowButtonList = new Dictionary <MetroForm.WindowButtons, MetroForm.MetroFormButton>();
     }
     if (this.windowButtonList.ContainsKey(button))
     {
         return;
     }
     MetroForm.MetroFormButton metroFormButton = new MetroForm.MetroFormButton();
     if (button == MetroForm.WindowButtons.Close)
     {
         metroFormButton.Text = "r";
     }
     else if (button == MetroForm.WindowButtons.Minimize)
     {
         metroFormButton.Text = "0";
     }
     else if (button == MetroForm.WindowButtons.Maximize)
     {
         if (base.WindowState == FormWindowState.Normal)
         {
             metroFormButton.Text = "1";
         }
         else
         {
             metroFormButton.Text = "2";
         }
     }
     metroFormButton.Tag    = button;
     metroFormButton.Size   = new Size(25, 20);
     metroFormButton.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
     metroFormButton.Click += this.WindowButton_Click;
     base.Controls.Add(metroFormButton);
     this.windowButtonList.Add(button, metroFormButton);
 }