private void button1_Click(object sender, EventArgs e) { UInt16 port; int porti; string pstr; if ((textBox1.Text == null) || (textBox3.Text == null)) { MessageBox.Show("请输入IP!"); } if (textBox2.Text == null) { MessageBox.Show("请输入端口号!"); } pstr = textBox2.Text; porti = (pstr[0] - '0') * 10000 + (pstr[1] - '0') * 1000 + (pstr[2] - '0') * 100 + (pstr[3] - '0') * 10 + (pstr[4] - '0'); port = (UInt16)porti; //HNC_Connect.start_connect(textBox1.Text, port); if (!HNC_Connect.start_connect(textBox1.Text, textBox3.Text, port)) { MessageBox.Show("连接失败,请重试"); return; } connect_event = true; this.Visible = false; HNC_Connect.start_transfer = true; Setting_save.savefile("save.dat"); //HNC_Connect.thread_connect(); }
private static void show_video(object sender, NewFrameEventArgs eventArgs) { HNC_Connect.hnc_con(); wms = NCVM_Form.wm; Bitmap temp_bm = (Bitmap)eventArgs.Frame.Clone(); #region WaterMark Write switch (Form2.selected_color) { case 0: drawBrush = new SolidBrush(Color.White); break; case 1: drawBrush = new SolidBrush(Color.Black); break; case 2: drawBrush = new SolidBrush(Color.Blue); break; case 3: drawBrush = new SolidBrush(Color.Red); break; case 4: drawBrush = new SolidBrush(Color.Yellow); break; case 5: drawBrush = new SolidBrush(Color.Green); break; default: drawBrush = new SolidBrush(Color.White); break; } if (Form2.rl_changed) { Form2.rl_changed = false; drawPoint_x = new PointF(left, bottom - 220); drawPoint_y = new PointF(left, bottom - 190); drawPoint_z = new PointF(left, bottom - 160); drawPoint_f = new PointF(left, bottom - 100); drawPoint_s = new PointF(left, bottom - 70); } using (Graphics g = Graphics.FromImage(temp_bm)) { g.DrawImage(wmlogo0, logo_rect1, logo_rect, GraphicsUnit.Pixel); if (Form2.wm_allowed) { g.DrawString(wms[0], drawFont, drawBrush, drawPoint_x); g.DrawString(wms[1], drawFont, drawBrush, drawPoint_y); g.DrawString(wms[2], drawFont, drawBrush, drawPoint_z); g.DrawString(wms[3], drawFont, drawBrush, drawPoint_f); g.DrawString(wms[4], drawFont, drawBrush, drawPoint_s); g.DrawString(wms[5], drawFont, drawBrush, drawPoint_g); g.DrawString(wms[6], drawFont, drawBrush, drawPoint_t); } g.Dispose(); } #endregion image_mutex.WaitOne(); if (bm != null) { bm.Dispose(); } bm = (Bitmap)temp_bm.Clone(); image_mutex.ReleaseMutex(); temp_bm.Dispose(); }