2021-05-21 仓库温控系统(Winform) 15 扩展控件-IconButton

许涵容
2023-12-01
public partial class UIconButton : Button
{
    public UIconButton()
    {
        InitializeComponent();
        //尺寸  字体  字号  FlatStyle FlatAppearance  ForeColor
        this.Size = new Size(30, 30);
        this.Font = new Font("Webdings", 10.8F);
        this.FlatStyle = FlatStyle.Flat;
        this.FlatAppearance.BorderSize = 0;
        this.Text = "0";
        this.ForeColor = Color.Silver;
        this.BackColor = Color.Transparent;
    }

    protected override void OnMouseEnter(EventArgs e)
    {
        base.OnMouseEnter(e);
        this.BackColor = Color.FromArgb(53, 61, 134);
    }

    protected override void OnMouseLeave(EventArgs e)
    {
        base.OnMouseLeave(e);
        this.BackColor = Color.Transparent;
    }

    /// <summary>
    /// 不显示聚焦框
    /// </summary>
    protected override bool ShowFocusCues
    {
        get { return false; }
    }
}

 类似资料: