1
0
mirror of synced 2024-09-24 03:28:21 +02:00
Switch-Toolbox/Switch_Toolbox_Library/Forms/Custom/STButton.cs
2020-01-14 20:26:51 -05:00

45 lines
1.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Drawing;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace Toolbox.Library.Forms
{
public class STButton : Button
{
public STButton()
{
BackColor = FormThemes.BaseTheme.FormBackColor;
ForeColor = FormThemes.BaseTheme.FormForeColor;
EnabledChanged += Button1_EnabledChanged;
Paint += btn_Paint;
if (FormThemes.ActivePreset == FormThemes.Preset.Dark)
{
FlatStyle = FlatStyle.Flat;
}
if (FormThemes.ActivePreset == FormThemes.Preset.White)
FlatStyle = FlatStyle.Standard;
}
public override void NotifyDefault(bool value)
{
base.NotifyDefault(false);
}
private void Button1_EnabledChanged(object sender, System.EventArgs e)
{
var btn = (Button)sender;
ForeColor = btn.Enabled == false ? FormThemes.BaseTheme.DisabledItemColor : FormThemes.BaseTheme.FormForeColor;
BackColor = btn.Enabled == false ? FormThemes.BaseTheme.FormBackColor : FormThemes.BaseTheme.FormBackColor;
}
private void btn_Paint(object sender, PaintEventArgs e)
{
}
}
}