Winform 控件添加事件

Winform 控件添加事件
        /// <summary>
        /// 添加按钮上鼠标 移入、移出、按下、弹起 事件
        /// </summary>
        /// <param name="btn">操作的按钮</param>
        private void AddBtnEvent(Button btn)
        {
            btn.MouseEnter += delegate (object sender, EventArgs e)
            {
                ((Button)sender).BackgroundImage = Resources.btnMouseEnter;
            };
            btn.MouseLeave += delegate (object sender, EventArgs e)
            {
                ((Button)sender).BackgroundImage = Resources.btnMouseLeave;
            };
            btn.MouseDown += delegate (object sender, MouseEventArgs e)
            {
                ((Button)sender).BackgroundImage = Resources.btnMouseDown
            };
            btn.MouseUp += delegate (object sender, MouseEventArgs e)
            {
                ((Button)sender).BackgroundImage = Resources.btnMouseUp;
            };
        }

作者最新文章
ASP.NET, ASP.NET Core WebApi 返回 Controller 返回 Json 类型结果
Visual Studio 调试 ASP.NET Core 无法连接 IIS Express 服务器
ASP.NET WebApi 与 ASP.NET Core WebApi 返回 HttpResponseMessage
SQL Server 中 CASE WHEN 使用
html table 设置表格背景图片,背景色