PanelLabel.cs 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. namespace IntelligentControlForsx.MyControls
  11. {
  12. public partial class PanelLabel : UserControl
  13. {
  14. public PanelLabel()
  15. {
  16. InitializeComponent();
  17. }
  18. public event EventHandler MyClick;
  19. public event EventHandler MyMouseEnter;
  20. public event EventHandler MyMouseLeave;
  21. [Browsable(true), Category("Appearance")]
  22. public string LableText
  23. {
  24. set { this.label1.Text = value; }
  25. get { return this.label1.Text; }
  26. }
  27. private void PanelLabel_Click(object sender, EventArgs e)
  28. {
  29. if (MyClick != null)
  30. {
  31. MyClick(this, e);
  32. }
  33. }
  34. private void PanelLabel_MouseEnter(object sender, EventArgs e)
  35. {
  36. if (!this.DesignMode)
  37. {
  38. this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))));
  39. if (MyMouseEnter != null)
  40. {
  41. MyMouseEnter(this.Name, e);
  42. }
  43. }
  44. }
  45. private void PanelLabel_MouseLeave(object sender, EventArgs e)
  46. {
  47. if (!this.DesignMode)
  48. {
  49. this.label1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(180)))), ((int)(((byte)(215)))), ((int)(((byte)(231)))));
  50. if (MyMouseLeave != null)
  51. {
  52. MyMouseLeave(this.Name, e);
  53. }
  54. }
  55. }
  56. }
  57. }