using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO.Ports;
using System.Threading;
namespace WindowsFormsApplication1
{
public partial class Form3 : Form
{
byte[] urt0_received=new byte[100];
byte[] manined_data = new byte[100];
Int16 count;
public Form3()
{
InitializeComponent();
this.printDocument1.PrintPage += new
System.Drawing.Printing.PrintPageEventHandler
(this.document_PrintPage);
this.docToPrint.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(printDocument1_PrintPage);
}
SerialPort serialPort1=new SerialPort();
// SerialPort serialPort2 = new SerialPort("COM2",9600);
private void button2_Click(object sender, EventArgs e)
{
//var t1 = new Thread(G_data);
//t1.Start();
Thread t1 = new Thread(mycom_DataReceived);
if (button2.Text == "打开")
{
serialPort3.Open();
button2.Text = "关闭";
t1.Start();
// timer1.Enabled = true;
}
else
{
button2.Text = "打开";
//timer1.Enabled =false ;
serialPort3.Close();
}
}
//
private void button1_Click(object sender, EventArgs e)
{
serialPort1.PortName = "COM5";
serialPort1.BaudRate = 9600;
serialPort1.Open();
// Byte[] BSendTemp = new Byte[1]; //建立临时字节数组对象