SerialPortCombox.cs 806 B

1234567891011121314151617181920212223242526272829303132333435363738
  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.Windows.Forms;
  9. using System.IO.Ports;
  10. namespace UAS_MES_NEW.CustomControl.ComBoxWithFocus
  11. {
  12. public partial class SerialPortCombox : UserControl
  13. {
  14. public SerialPortCombox()
  15. {
  16. InitializeComponent();
  17. }
  18. public override string Text
  19. {
  20. get
  21. {
  22. return ComCombox.Text;
  23. }
  24. set
  25. {
  26. ComCombox.Text = value;
  27. }
  28. }
  29. private void SerialPortCombox_Load(object sender, EventArgs e)
  30. {
  31. ComCombox.Items.AddRange(SerialPort.GetPortNames());
  32. }
  33. }
  34. }