private void button7_Click(object sender, EventArgs e) { bb = new RS232C("ThomasPeng"); cc = bb; //以下效果相同,接口的实现方式与VB中不同 //MessageBox.Show(cc.AvailableRS232CPortCount().ToString()); MessageBox.Show(bb.AvailableRS232CPortCount().ToString()); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (excl != null) { excl.Dispose(); } excl = null; if (mmm != null) { mmm.Dispose(); } mmm = null; if (RSPort != null) { RSPort.ClosePort(); } RSPort = null; bb = null; cc = null; if (xxxx != null) { xxxx.Close(); } xxxx = null; if (ww != null) { ww.Dispose(); } ww = null; if (Test != null) { Test.Close(); } Test = null; ReadData = null; //ll.Close(); }