SerialPortCombox.cs 664 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.IO.Ports;
  3. using System.Windows.Forms;
  4. namespace UAS_MES_NEW.CustomControl.ComBoxWithFocus
  5. {
  6. public partial class SerialPortCombox : UserControl
  7. {
  8. public SerialPortCombox()
  9. {
  10. InitializeComponent();
  11. }
  12. public override string Text
  13. {
  14. get
  15. {
  16. return ComCombox.Text;
  17. }
  18. set
  19. {
  20. ComCombox.Text = value;
  21. }
  22. }
  23. private void SerialPortCombox_Load(object sender, EventArgs e)
  24. {
  25. ComCombox.Items.AddRange(SerialPort.GetPortNames());
  26. }
  27. }
  28. }