using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using IntelligentControlForsx.Code; namespace IntelligentControlForsx.MyControls { public partial class BottomOld : UserControl { Dictionary mouseEnterDic = new Dictionary(); Dictionary mouseLeaveDic = new Dictionary(); public BottomOld() { InitializeComponent(); if (!this.DesignMode) { mouseEnterDic.Add(lblAll.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblFC.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblNSS.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblMHS.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblQS.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblSBQ.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblXS.Name, Color.FromArgb(0, 148, 220)); mouseEnterDic.Add(lblGF.Name, Color.FromArgb(1, 200, 115)); mouseEnterDic.Add(lblDWK.Name, Color.FromArgb(1, 200, 115)); mouseEnterDic.Add(lblPL.Name, Color.FromArgb(1, 200, 115)); mouseEnterDic.Add(lblXH.Name, Color.FromArgb(1, 200, 115)); mouseEnterDic.Add(lblMCH.Name, Color.FromArgb(1, 200, 115)); mouseLeaveDic.Add(lblAll.Name, Color.FromArgb(6, 34, 62)); mouseLeaveDic.Add(lblFC.Name, Color.FromArgb(0, 78, 140)); mouseLeaveDic.Add(lblNSS.Name, Color.FromArgb(0, 78, 140)); mouseLeaveDic.Add(lblMHS.Name, Color.FromArgb(0, 78, 140)); mouseLeaveDic.Add(lblQS.Name, Color.FromArgb(0, 78, 140)); mouseLeaveDic.Add(lblSBQ.Name, Color.FromArgb(0, 78, 140)); mouseLeaveDic.Add(lblXS.Name, Color.FromArgb(0, 78, 140)); mouseLeaveDic.Add(lblGF.Name, Color.FromArgb(1, 112, 115)); mouseLeaveDic.Add(lblDWK.Name, Color.FromArgb(1, 112, 115)); mouseLeaveDic.Add(lblPL.Name, Color.FromArgb(1, 112, 115)); mouseLeaveDic.Add(lblXH.Name, Color.FromArgb(1, 112, 115)); mouseLeaveDic.Add(lblMCH.Name, Color.FromArgb(1, 112, 115)); defalutLable = new Label(); } } Label defalutLable; [Browsable(true), Category("Appearance")] public Label DefaultLable { get { return defalutLable; } set { if (!this.DesignMode) { if (defalutLable.Name != null && defalutLable.Name.Trim() != "") { value.BackColor = mouseEnterDic[value.Name]; ; value.Height = 46; value.Cursor = Cursors.Default; defalutLable.BackColor = mouseLeaveDic[defalutLable.Name]; defalutLable.Height = 37; defalutLable.Cursor = System.Windows.Forms.Cursors.Hand; } } defalutLable = value; } } private void lbl_MouseEnter(object sender, System.EventArgs e) { if (!this.DesignMode) { Label lable = (Label)sender; lable.Height = 46; lable.BackColor = mouseEnterDic[lable.Name]; } } private void lbl_MouseLeave(object sender, System.EventArgs e) { if (!this.DesignMode) { Label lable = (Label)sender; if (defalutLable.Name != lable.Name) { lable.Height = 37; lable.BackColor = mouseLeaveDic[lable.Name]; } } } public event EventHandler MyClick; private void lbl_Click(object sender, System.EventArgs e) { if (!this.DesignMode) { Label lable = (Label)sender; MyClick(lable.Tag, e); DefaultLable = lable; } } } }