using System;
|
|
using System.Collections.Generic;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using System.Windows.Forms;
|
|
|
|
namespace Test
|
|
{
|
|
class TBtn : Button
|
|
{
|
|
public TBtn()
|
|
{
|
|
//this.UseVisualStyleBackColor = true;
|
|
this.BackColor = Color.FromArgb(51, 133, 255);
|
|
this.ForeColor = Color.White;
|
|
this.FlatStyle = FlatStyle.Flat;
|
|
this.FlatAppearance.BorderSize = 0;
|
|
this.FlatAppearance.BorderColor = Color.FromArgb(45, 204, 112);
|
|
}
|
|
|
|
protected override void OnMouseDown(MouseEventArgs mevent)
|
|
{
|
|
if (mevent.Button == MouseButtons.Left)
|
|
{
|
|
this.BackColor = Color.Red;
|
|
}
|
|
base.OnMouseDown(mevent);
|
|
}
|
|
|
|
protected override void OnClick(EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.Enabled = false;
|
|
base.OnClick(e);
|
|
}
|
|
finally
|
|
{
|
|
this.Enabled = true;
|
|
}
|
|
}
|
|
|
|
protected override void OnEnabledChanged(EventArgs e)
|
|
{
|
|
base.OnEnabledChanged(e);
|
|
if (Enabled)
|
|
{
|
|
this.BackColor = Color.FromArgb(51, 133, 255);
|
|
}
|
|
else
|
|
{
|
|
this.BackColor = Color.FromArgb(209, 213, 216);
|
|
}
|
|
}
|
|
}
|
|
}
|