Пример #1
0
        private void StylizeButton(MetroButton button, bool hovered)
        {
            button.Cursor = Cursors.Hand;

            button.MouseClick -= button_MouseClick;
            button.MouseClick += button_MouseClick;

            button.MouseEnter -= button_MouseEnter;
            button.MouseEnter += button_MouseEnter;

            button.MouseLeave -= button_MouseLeave;
            button.MouseLeave += button_MouseLeave;

            if (hovered)
            {
                button.FlatAppearance.BorderColor = Color.FromArgb(255, 102, 102, 102);
                button.ForeColor = Color.FromArgb(255, 255, 255, 255);
            }
            else
            {
                button.BackColor = Color.FromArgb(255, 238, 238, 238);
                button.FlatAppearance.BorderColor = Color.SlateGray;
                //button.FlatAppearance.BorderColor = Color.Red;
                button.FlatAppearance.MouseOverBackColor = Color.FromArgb(255, 102, 102, 102);
                button.ForeColor = Color.FromArgb(255, 0, 0, 0);
                button.FlatAppearance.BorderSize = 1;
            }
            button.Font = new Font("微软雅黑", 11f, FontStyle.Regular, GraphicsUnit.Pixel);
        }
Пример #2
0
        private void button_MouseClick(object sender, MouseEventArgs e)
        {
            MetroButton button = (MetroButton)sender;

            button.BackColor = Color.FromArgb(255, 51, 51, 51);
            button.FlatAppearance.BorderColor = Color.FromArgb(255, 51, 51, 51);
            button.ForeColor = Color.FromArgb(255, 255, 255, 255);
        }
Пример #3
0
        private void button_Click(object sender, EventArgs e)
        {
            MetroButton button = (MetroButton)sender;

            if (!button.Enabled)
            {
                return;
            }
            _result = (DialogResult)button.Tag;
            Hide();
        }
Пример #4
0
 private void StylizeButton(MetroButton button)
 {
     StylizeButton(button, false);
 }
Пример #5
0
 private void EnableButton(MetroButton button, bool enabled)
 {
     button.Enabled = enabled; button.Visible = enabled;
 }
Пример #6
0
 private void EnableButton(MetroButton button)
 {
     EnableButton(button, true);
 }