BottomOld.cs 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Windows.Forms;
  6. using IntelligentControlForsx.Code;
  7. namespace IntelligentControlForsx.MyControls
  8. {
  9. public partial class BottomOld : UserControl
  10. {
  11. Dictionary<string, Color> mouseEnterDic = new Dictionary<string, Color>();
  12. Dictionary<string, Color> mouseLeaveDic = new Dictionary<string, Color>();
  13. public BottomOld()
  14. {
  15. InitializeComponent();
  16. if (!this.DesignMode)
  17. {
  18. mouseEnterDic.Add(lblAll.Name, Color.FromArgb(0, 148, 220));
  19. mouseEnterDic.Add(lblFC.Name, Color.FromArgb(0, 148, 220));
  20. mouseEnterDic.Add(lblNSS.Name, Color.FromArgb(0, 148, 220));
  21. mouseEnterDic.Add(lblMHS.Name, Color.FromArgb(0, 148, 220));
  22. mouseEnterDic.Add(lblQS.Name, Color.FromArgb(0, 148, 220));
  23. mouseEnterDic.Add(lblSBQ.Name, Color.FromArgb(0, 148, 220));
  24. mouseEnterDic.Add(lblXS.Name, Color.FromArgb(0, 148, 220));
  25. mouseEnterDic.Add(lblGF.Name, Color.FromArgb(1, 200, 115));
  26. mouseEnterDic.Add(lblDWK.Name, Color.FromArgb(1, 200, 115));
  27. mouseEnterDic.Add(lblPL.Name, Color.FromArgb(1, 200, 115));
  28. mouseEnterDic.Add(lblXH.Name, Color.FromArgb(1, 200, 115));
  29. mouseEnterDic.Add(lblMCH.Name, Color.FromArgb(1, 200, 115));
  30. mouseLeaveDic.Add(lblAll.Name, Color.FromArgb(6, 34, 62));
  31. mouseLeaveDic.Add(lblFC.Name, Color.FromArgb(0, 78, 140));
  32. mouseLeaveDic.Add(lblNSS.Name, Color.FromArgb(0, 78, 140));
  33. mouseLeaveDic.Add(lblMHS.Name, Color.FromArgb(0, 78, 140));
  34. mouseLeaveDic.Add(lblQS.Name, Color.FromArgb(0, 78, 140));
  35. mouseLeaveDic.Add(lblSBQ.Name, Color.FromArgb(0, 78, 140));
  36. mouseLeaveDic.Add(lblXS.Name, Color.FromArgb(0, 78, 140));
  37. mouseLeaveDic.Add(lblGF.Name, Color.FromArgb(1, 112, 115));
  38. mouseLeaveDic.Add(lblDWK.Name, Color.FromArgb(1, 112, 115));
  39. mouseLeaveDic.Add(lblPL.Name, Color.FromArgb(1, 112, 115));
  40. mouseLeaveDic.Add(lblXH.Name, Color.FromArgb(1, 112, 115));
  41. mouseLeaveDic.Add(lblMCH.Name, Color.FromArgb(1, 112, 115));
  42. defalutLable = new Label();
  43. }
  44. }
  45. Label defalutLable;
  46. [Browsable(true), Category("Appearance")]
  47. public Label DefaultLable
  48. {
  49. get
  50. {
  51. return defalutLable;
  52. }
  53. set
  54. {
  55. if (!this.DesignMode)
  56. {
  57. if (defalutLable.Name != null && defalutLable.Name.Trim() != "")
  58. {
  59. value.BackColor = mouseEnterDic[value.Name]; ;
  60. value.Height = 46;
  61. value.Cursor = Cursors.Default;
  62. defalutLable.BackColor = mouseLeaveDic[defalutLable.Name];
  63. defalutLable.Height = 37;
  64. defalutLable.Cursor = System.Windows.Forms.Cursors.Hand;
  65. }
  66. }
  67. defalutLable = value;
  68. }
  69. }
  70. private void lbl_MouseEnter(object sender, System.EventArgs e)
  71. {
  72. if (!this.DesignMode)
  73. {
  74. Label lable = (Label)sender;
  75. lable.Height = 46;
  76. lable.BackColor = mouseEnterDic[lable.Name];
  77. }
  78. }
  79. private void lbl_MouseLeave(object sender, System.EventArgs e)
  80. {
  81. if (!this.DesignMode)
  82. {
  83. Label lable = (Label)sender;
  84. if (defalutLable.Name != lable.Name)
  85. {
  86. lable.Height = 37;
  87. lable.BackColor = mouseLeaveDic[lable.Name];
  88. }
  89. }
  90. }
  91. public event EventHandler MyClick;
  92. private void lbl_Click(object sender, System.EventArgs e)
  93. {
  94. if (!this.DesignMode)
  95. {
  96. Label lable = (Label)sender;
  97. MyClick(lable.Tag, e);
  98. DefaultLable = lable;
  99. }
  100. }
  101. }
  102. }