private void BalanceSerialPort_SelectedIndexChanged(object sender, EventArgs e) { if (m_DetectBalance == null) { m_DetectBalance = new HangingBalance(); } string name = m_DetectBalance.FreshCom(BalanceSerialPort.Items[BalanceSerialPort.SelectedIndex].ToString()); if (string.IsNullOrEmpty(name)) { picConnectState.Image = global::HangBalance.Properties.Resources.error2; mCalibration.EnableCalibrate(false); } else { picConnectState.Image = global::HangBalance.Properties.Resources.ok2; mCalibration.SetPortName(name); mCalibration.EnableCalibrate(true); } }