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;
            };
        }

作者最新文章
C# 实现字符串文本换行的方法,文本如何换行
C# 如何循环读取文件每一行文本内容
C# DateTime AddMonths 的错误用法导致跳过日期
C# 全角转换半角,半角转换为全角
C# Word 转换 PDF 文件,如何转换 PDF