好文档就是一把金锄头!
欢迎来到金锄头文库![会员中心]
电子文档交易市场
安卓APP | ios版本
电子文档交易市场
安卓APP | ios版本

对labview通过usb控制agilent33220任意波形手写输入的再一次完善.doc

7页
  • 卖家[上传人]:
  • 文档编号:43419701
  • 上传时间:2018-06-06
  • 文档格式:DOC
  • 文档大小:14.84KB
  • / 7 举报 版权申诉 马上下载
  • 文本预览
  • 下载提示
  • 常见问题
    • 对对 labviewlabview 通过通过 USBUSB 控制控制 agilent33220agilent33220 任意波形手写输入的再一次任意波形手写输入的再一次完善完善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;namespace WindowsFormsApplication6{public partial class Form1 : Form{public Form1(){InitializeComponent();myTimer = new HiPerfTimer();}private Point point, pp; private bool mark = false; private int aa;Image myImage = new Bitmap(689, 399); //建个图层。

      内存法private void pictureBox1_MouseMove(object sender, MouseEventArgs e){if(mark)//mark=true 时才触发,鼠标没左键的时候不会进行{Graphics g = Graphics.FromImage(myImage);g.DrawLine(Pens.Red,point.X,point.Y, e.X, e.Y);//在图层里面,避免 n 多的问题画线为红色point.X = e.X;point.Y = e.Y;}}private void pictureBox1_MouseDown(object sender, MouseEventArgs e){myTimer.ClearTimer();myTimer.Start();File.Delete(“c:\\2.txt“); //下次再画时删除2.txtGraphics g = Graphics.FromImage(myImage);g.Clear(Color.Empty);pictureBox1.Image = myImage;//3 句话,清空picturebox。

      if (e.Button == MouseButtons.Left)// 鼠标左键才正式画画,避免失误点击了右键{pp.X = e.X;point.X = e.X;point.Y = e.Y;mark = true;//mark 开始时 false,左键以后为true}}private void pictureBox1_MouseUp(object sender, MouseEventArgs e){myTimer.Stop();label2.Text = “画图所用时间:“ + “\n“ +(myTimer.Duration / 1000).ToString(“####.###“) + “秒“;myTimer.ClearTimer();myTimer.Start();mark = false;//为下次画做准备Bitmap image = (Bitmap)myImage;System.Drawing.Imaging.BitmapData data = image.LockBits( new Rectangle( 0 , 0 , image.Width , image.Height ) , System.Drawing.Imaging.ImageLockMode.ReadWrite , image.PixelFormat );StringBuilder sb = new StringBuilder();int endx; int startx;startx = pp.X;if (point.X > data.Width) endx = data.Width;else endx = point.X;if (pp.X > point.X) { endx = pp.X; startx = point.X; } //支持右侧向左侧画,代码有点搓。

      unsafe{byte* ptr = (byte*)(data.Scan0);byte *p=(byte*)(data.Scan0);for (int j = startx; j 2aa = 0; }}private void timer1_Tick(object sender, EventArgs e){if (mark){label3.Text = “瞬时坐标:“ + “\n“ +“X=“ + point.X.ToString() + “\n“ + “Y=“ + (400 - point.Y).ToString();//label 显示 x,y 值pictureBox1.Image = myImage;//图层显示在picturebox 里面}}private void pictureBox2_MouseDown(object sender, MouseEventArgs e){System.Diagnostics.Process.Start(“IEXPLORE.EXE“, “ }下载地址:。

      点击阅读更多内容
      关于金锄头网 - 版权申诉 - 免责声明 - 诚邀英才 - 联系我们
      手机版 | 川公网安备 51140202000112号 | 经营许可证(蜀ICP备13022795号)
      ©2008-2016 by Sichuan Goldhoe Inc. All Rights Reserved.