• 扩展控件属性


    1、创建用户控件项目

    2、    注释以下这一行 

            private void InitializeComponent()
            {
                components = new System.ComponentModel.Container();
                //this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            }

        public partial class ExLabel : Label

        {

            public ExLabel()

            {

                InitializeComponent();

                this.Click += new EventHandler(exLabel_Click); 

            }

               protected override void OnMouseEnter(System.EventArgs e)  

               {  

                   base.OnMouseEnter(e);

                   this.ForeColor = Color.Black;

                   this.BackColor = Color.White;

                //this.Font = new Font("宋体", 10F, FontStyle.Underline);  

               }  

      

             protected override void OnMouseLeave(System.EventArgs e)  

              {  

                  base.OnMouseLeave(e);

                  this.ForeColor = Color.White;

                  this.BackColor = Color.Black;

                  //this.Font = new Font("宋体", 10F, FontStyle.Regular);  

              }

             private void exLabel_Click(object sender, EventArgs e)

             {

                 this.ForeColor = Color.Magenta;

                 //this.BackColor = Color.Blue;

             }

  • 相关阅读:
    java反编译工具
    javascript
    微信小程序
    微信小程序
    微信小程序
    微信小程序
    微信小程序
    微信小程序
    微信小程序
    微信小程序
  • 原文地址:https://www.cnblogs.com/xihong2014/p/4208960.html
Copyright © 2020-2023  润新知