ComBoxWithFocus.cs 657 B

1234567891011121314151617181920212223242526
  1. using System;
  2. using System.Drawing;
  3. using System.Windows.Forms;
  4. namespace UAS_MES_NEW.CustomControl.ComBoxWithFocus
  5. {
  6. public partial class ComBoxWithFocus : ComboBox
  7. {
  8. public ComBoxWithFocus()
  9. {
  10. InitializeComponent();
  11. this.Enter += this.ComBoxWithFocus_Enter;
  12. this.Leave += this.ComBoxWithFocus_Leave;
  13. }
  14. private void ComBoxWithFocus_Enter(object sender, EventArgs e)
  15. {
  16. this.BackColor = Color.GreenYellow;
  17. }
  18. private void ComBoxWithFocus_Leave(object sender, EventArgs e)
  19. {
  20. this.BackColor = Color.White;
  21. }
  22. }
  23. }