public OptionForm() { InitializeComponent(); strPath = @"C:\Users\abc\Desktop\Power Simulator\Power Simulator\sys\option.ini"; ini = new INIFILE(strPath); string[] port = { "COM1", "COM2", "COM3", "COM4", "COM5", "COM6" }; comboBox1.Items.AddRange(port); comboBox2.Items.AddRange(port); comboBox3.Items.AddRange(port); string[] baudrate1 = { "9600", "19200", "38400", "57600", "115200", "230400" }; comboBox4.Items.AddRange(baudrate1); string[] baudrate2 = { "1200", "2400", "4800", "9600", "19200", "38400", "57600" }; comboBox5.Items.AddRange(baudrate2); string[] baudrate3 = { "1200", "2400", "4800", "9600", "19200" }; comboBox6.Items.AddRange(baudrate3); if (Directory.Exists(@"C:\Users\abc\Desktop\Power Simulator\Power Simulator\sys")) { comboBox1.Text = ini.Read("POWER1", "PortName", ""); comboBox2.Text = ini.Read("POWER2", "PortName", ""); comboBox3.Text = ini.Read("POWER3", "PortName", ""); comboBox4.Text = ini.Read("POWER1", "BaudRate", ""); comboBox5.Text = ini.Read("POWER2", "BaudRate", ""); comboBox6.Text = ini.Read("POWER3", "BaudRate", ""); } }
public MainForm() { InitializeComponent(); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; this.WindowState = FormWindowState.Maximized; if (DEBUG_MODE != 0) { BTN_Profile.PerformClick(); return; } //strPath = @"C:\Users\abc\Desktop\Power Simulator\Power Simulator\sys"; if (Directory.Exists(@"C:\Users\abc\Desktop\Power Simulator\Power Simulator\sys")) { ini = new INIFILE(@"C:\Users\abc\Desktop\Power Simulator\Power Simulator\sys\option.ini"); } DeviceConnect(); TestformOpen(); }