示例#1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            comboBox2.SelectedIndex = 0;
            comboBox3.SelectedIndex = 2;
            isInit = true;
            for (; com < comboBox1.Items.Count; com++)
            {
                comboBox1.SelectedIndex = com;
                if (com == 0)
                {
                    break;
                }
            }
            if (com != 0)
            {
                comboBox1.SelectedIndex = 0;
                MessageBox.Show("没有找到可用的串口");
            }
            ccmd.run(ccmd.stopCMD);

            //timer1.Start();


            updateText = new Flush_textbox(flush_textbox);  //实例化委托对象
        }
示例#2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            sp = new SerialPort("COM8", 460800, Parity.None, 8, StopBits.One);
            sp.DataReceived          += new System.IO.Ports.SerialDataReceivedEventHandler(readSerialPort);
            sp.ReceivedBytesThreshold = 4;//设置 DataReceived 事件发生前内部输入缓冲区中的字节数
            sp.Open();
            sp.ReadTimeout = 10;

            updateText = flush_textbox;


            /* for(int x=0;x<240;x++)
             *   for(int y=0;y<320;y++)
             *       bmp.SetPixel(x,y,Color.FromArgb(10,80,200));
             * pictureBox1.Image = bmp;*/

            //tmp[0] = ;
            textBox1.Text = (unchecked ((byte)(0x0f << 4))).ToString();
        }