MPU6050 实时图表上位机 C#

MPU6050 实时图表上位机 C#_第1张图片

参考WinForm做Win8 MetroLoad效果的项目做的。

串口数据格式是固定的,16进制CSV格式,别的不行。MPU6050 实时图表上位机 C#_第2张图片

代码挺乱的,初学者。


Communicate.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO.Ports;
using System.Threading;

namespace MagicCubeView {

	class Communicate {
		
		#region 常量

		/// 
		/// 最大数据长度
		/// 
		const int _MAX_LENGTH = 2000;

		/// 
		/// 串口读取超时ms
		/// 
		const int _TIMEOUT = 20;

		#endregion




		#region 变量

		/// 
		/// 串口
		/// 
		SerialPort _sp = null;

		List _data = null;

		/// 
		/// 通讯线程
		/// 
		Thread _CoreThread = null;

		/// 
		/// 已连接
		/// 
		bool _Link = false;

		#endregion



		#region 公共

		public List Data {
			get { return _data; }
		}

		/// 
		/// 构造
		/// 
		/// 
		public Communicate(string ComName) {

			if (_sp != null) {
				if (_sp.IsOpen == true) {
					_sp.Close();
				}
				_sp = null;
			}

			_sp = new SerialPort();
			_sp.PortName = ComName;
			_sp.BaudRate = 115200;       //波特率  
			_sp.DataBits = 8;       //数据位  
			_sp.StopBits = StopBits.One;  //停止位  
			_sp.Parity = Parity.None;    //校验位	

			_sp.ReadTimeout = _TIMEOUT;
			_sp.Open();

			if (_CoreThread != null) {
				if ((_CoreThread.ThreadState == ThreadState.Unstarted) || (_CoreThread.ThreadState == ThreadState.Stopped)) {
				} else {
					throw new Exception("\r\n错误!线程正在运行." + _CoreThread.ThreadState);
				}
			}
			_CoreThread = new Thread(Run);
			_CoreThread.Name = "串口线程";
			_CoreThread.IsBackground = true;
			_CoreThread.Start();

			_data = new List();

		}

		/// 
		/// 断开连接
		/// 
		public void DisLink() {
			_Link = false;
		}

		/// 
		/// 枚举串口
		/// 
		/// 
		public static string[] GetPortName() {
			return SerialPort.GetPortNames();
		}

		#endregion





		#region 运行

		/// 
		/// 字符串解析
		/// 
		/// 
		/// 
		Frame makeFrame(string s) {
			Frame f = null;
			string[] ss = s.Split(',');
			if (ss.Length == 6) {
				f = new Frame();
				f.a = Convert.ToInt32(ss[0], 16);
				f.b = Convert.ToInt32(ss[1], 16);
				f.c = Convert.ToInt32(ss[2], 16);
				f.d = Convert.ToInt32(ss[3], 16);
				f.e = Convert.ToInt32(ss[4], 16);
				f.f = Convert.ToInt32(ss[5].TrimEnd('\r').TrimEnd('\n'), 16);
			} else {
				Console.WriteLine("ss.Length != 6");
			}
			return f;
		}

		void Run() {
			_Link = true;
			for (; ; ) {
				try {
					string s = _sp.ReadLine();
					try {
						if(_data.Count >= _MAX_LENGTH){
							_data.RemoveAt(0);
						}
						Frame f = makeFrame(s);
						if (f != null) {
							_data.Add(f);
						}
					}catch(Exception ex){
						Console.WriteLine(ex.Message);
					}
				} catch{
				}
				if(_Link == false){
					_sp.Close();
					break;
				}
			}
		}
		#endregion

	}
}









Form1.cs

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.Drawing.Drawing2D;
using System.Collections;

namespace MagicCubeView {
	public partial class Form1 : Form {


		#region 字段

		/// 
		/// 绘图tmr
		/// 
		private System.Windows.Forms.Timer _graphicsTmr;

		/// 
		/// 通讯
		/// 
		Communicate comm = null;

		#endregion 字段



		#region 参数

		/// 
		/// 绘制间隔
		/// 
		private const int DRAW_INTERVAL = 5;

		private const int PEN_SIZE = 2;

		private int WIDTH = 1600;
		private int HEIGTH = 800;

		/// 
		/// X轴间隔(几个点数一格)
		/// 
		private int FRAME_GAP = 50;

		/// 
		/// 屏幕上的可显示的点数
		/// 
		private int FRAME_COUNT = 1000;

		private int VALUE_GAP = 5000;
		private int MAX_VALUE = 70000;
		private int MIN_VALUE = 0;

		private int FIX = 30000;
		private int FIX1 = -20000;
		private int FIX2 = 0;
		private int FIX3 = 41000;
		private int FIX4 = 40000;
		private int FIX5 = 42000;

		private int ShowCharUpdateCnt = 0;

		private UInt16 RedChar = 0;
		private UInt16 GreenChar = 0;
		private UInt16 YellowChar = 0;

		private UInt16 RedCharFix = 0;
		private UInt16 GreenCharFix = 0;
		private UInt16 YellowCharFix = 0;

		private bool show1 = true;
		private bool show2 = true;
		private bool show3 = true;
		private bool show4 = true;
		private bool show5 = true;
		private bool show6 = true;

		#endregion 参数





		#region 构造

		public Form1() {
			InitializeComponent();
			//双缓冲,禁擦背景
			this.SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);

			SizeReDifine();

			//初始化绘图timer
			_graphicsTmr = new System.Windows.Forms.Timer();
			_graphicsTmr.Interval = DRAW_INTERVAL;
			_graphicsTmr.Tick += (sender1, e1) => this.pictureBox1.Invalidate(false);

			_graphicsTmr.Start();
			MJ();

			UpdateParamBack();
			UpdateParamBackFix();
		}

		/// 
		/// 枚举串口
		/// 
		void MJ() {
			string[] ss = Communicate.GetPortName();
			this.comboBox1.Items.Clear();
			foreach (string s in ss) {
				this.comboBox1.Items.Add(s);
			}
			if (ss.Length > 0) {
				this.comboBox1.SelectedIndex = 0;
			}
		}

		#endregion 构造




		#region 事件处理

		/// 
		/// 数值转Y坐标
		/// 
		/// 
		/// 
		float PositionY(int Value) {
			return (float)HEIGTH - (float)HEIGTH * ((float)Value - (float)MIN_VALUE) / ((float)MAX_VALUE - (float)MIN_VALUE);
		}

		//重绘
		private void pictureBox1_Paint(object sender, PaintEventArgs e) {
			//抗锯齿
			e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
			using (Bitmap bmp = new Bitmap(WIDTH, HEIGTH)) {
				//缓冲绘制
				using (Graphics bufferGraphics = Graphics.FromImage(bmp)) {
					//抗锯齿
					bufferGraphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
					LinearGradientBrush linGrBrush = new LinearGradientBrush(//背景
					   new Point(0, 0),
					   new Point(0, HEIGTH),
					   Color.FromArgb(255, 0, 0, 0),   // Opaque red
					   Color.FromArgb(255, 0, 0, 60));  // Opaque blue
					bufferGraphics.FillRectangle(linGrBrush, 0, 0, WIDTH, HEIGTH);

					for (int y = MIN_VALUE; y <= MAX_VALUE; y += VALUE_GAP) {//横线
						bufferGraphics.DrawLine(new Pen(Color.Gray, 1), 0, PositionY(y), WIDTH, PositionY(y));
						bufferGraphics.DrawString("" + y, new Font("Arial", 8), new SolidBrush(Color.Gray), new PointF(5, (PositionY(y) - 12) <= 0 ? 1 : (PositionY(y) - 12)));
					}

					for (int x = 0; x < WIDTH; x += WIDTH * FRAME_GAP / FRAME_COUNT) {//竖线
						bufferGraphics.DrawLine(new Pen(Color.Gray, 1), x, 0, x, HEIGTH);
					}

					try {
						if (comm != null && comm.Data != null) {//未连接 不绘图
							float pGap = ((float)WIDTH) / (float)FRAME_COUNT;//一帧数据间隔

							List pp = new List();
							List pp1 = new List();
							List pp2 = new List();
							List pp3 = new List();
							List pp4 = new List();
							List pp5 = new List();

							float x = 0;
							for (int i = comm.Data.Count - 1; i >= 0; i--) {

								UInt16 aa = (UInt16)comm.Data[i].a;
								UInt16 bb = (UInt16)comm.Data[i].b;
								UInt16 cc = (UInt16)comm.Data[i].c;
								UInt16 dd = (UInt16)comm.Data[i].d;
								UInt16 ee = (UInt16)comm.Data[i].e;
								UInt16 ff = (UInt16)comm.Data[i].f;

								aa += (UInt16)FIX;
								bb += (UInt16)FIX1;
								cc += (UInt16)FIX2;
								dd += (UInt16)FIX3;
								ee += (UInt16)FIX4;
								ff += (UInt16)FIX5;

								pp.Add(new PointF(x, PositionY(aa)));
								pp1.Add(new PointF(x, PositionY(bb)));
								pp2.Add(new PointF(x, PositionY(cc)));
								pp3.Add(new PointF(x, PositionY(dd)));
								pp4.Add(new PointF(x, PositionY(ee)));
								pp5.Add(new PointF(x, PositionY(ff)));

								x += pGap;
							}

							PointF[] Lines = new PointF[pp.Count];
							PointF[] Lines1 = new PointF[pp.Count];
							PointF[] Lines2 = new PointF[pp.Count];
							PointF[] Lines3 = new PointF[pp.Count];
							PointF[] Lines4 = new PointF[pp.Count];
							PointF[] Lines5 = new PointF[pp.Count];

							for (int i = 0; i < pp.Count; i++) {
								Lines[i] = pp[i];
								Lines1[i] = pp1[i];
								Lines2[i] = pp2[i];
								Lines3[i] = pp3[i];
								Lines4[i] = pp4[i];
								Lines5[i] = pp5[i];
							}

							Pen RedPen = new Pen(Color.Red, PEN_SIZE);
							Pen GreenPen = new Pen(Color.Lime, PEN_SIZE);
							Pen YellowPen = new Pen(Color.Yellow, PEN_SIZE);
							Pen Pen3 = new Pen(Color.YellowGreen, PEN_SIZE);
							Pen Pen4 = new Pen(Color.Tomato, PEN_SIZE);
							Pen Pen5 = new Pen(Color.Fuchsia, PEN_SIZE);

							//bufferGraphics.DrawCurve(RedPen, Lines);

							if (show1)
								bufferGraphics.DrawLines(RedPen, Lines);
							if (show2)
								bufferGraphics.DrawLines(GreenPen, Lines1);
							if (show3)
								bufferGraphics.DrawLines(YellowPen, Lines2);

							//if (show4)
							//    bufferGraphics.DrawCurve(Pen3, Lines3);
							//if (show5)
							//    bufferGraphics.DrawCurve(Pen4, Lines4);
							//if (show6)
							//    bufferGraphics.DrawCurve(Pen5, Lines5);

							if (show4)
								bufferGraphics.DrawLines(Pen3, Lines3);
							if (show5)
								bufferGraphics.DrawLines(Pen4, Lines4);
							if (show6)
								bufferGraphics.DrawLines(Pen5, Lines5);

							ShowCharUpdateCnt++;
							if (ShowCharUpdateCnt >= 10) {
								ShowCharUpdateCnt = 0;

								RedChar = (UInt16)comm.Data[comm.Data.Count - 1].a;
								GreenChar = (UInt16)comm.Data[comm.Data.Count - 1].b;
								YellowChar = (UInt16)comm.Data[comm.Data.Count - 1].c;

								RedCharFix = (UInt16)(RedChar + FIX);
								GreenCharFix = (UInt16)(GreenChar + FIX1);
								YellowCharFix = (UInt16)(YellowChar + FIX2);
							}

							bufferGraphics.DrawString(RedChar + "", new Font("Arial", 8), new SolidBrush(Color.Red), new PointF(WIDTH - 50, 5));
							bufferGraphics.DrawString(GreenChar + "", new Font("Arial", 8), new SolidBrush(Color.Green), new PointF(WIDTH - 50, 15));
							bufferGraphics.DrawString(YellowChar + "", new Font("Arial", 8), new SolidBrush(Color.Yellow), new PointF(WIDTH - 50, 25));

							//bufferGraphics.DrawString(RedCharFix + "", new Font("Arial", 8), new SolidBrush(Color.Red), new PointF(WIDTH - 100, 5));
							//bufferGraphics.DrawString(GreenCharFix + "", new Font("Arial", 8), new SolidBrush(Color.Green), new PointF(WIDTH - 100, 15));
							//bufferGraphics.DrawString(YellowCharFix + "", new Font("Arial", 8), new SolidBrush(Color.Yellow), new PointF(WIDTH - 100, 25));


						}
					} catch (Exception ex) {
						Console.WriteLine(FRAME_COUNT + "," + comm.Data.Count + ",");
						Console.WriteLine(ex);
					}

				}

				//贴图
				e.Graphics.DrawImage(bmp, new PointF(0, 0));
			}//bmp disposed
		}

		//枚举
		private void button1_Click(object sender, EventArgs e) {
			MJ();
		}

		//连接
		private void button2_Click(object sender, EventArgs e) {
			if (this.comm == null) {

				if (this.comboBox1.SelectedIndex == -1) {
					MessageBox.Show("选择一个串口连接");
				} else {
					this.comm = new Communicate((string)this.comboBox1.SelectedItem);
					((Button)sender).Text = "断开";
					((Button)sender).ForeColor = Color.Red;
				}

			} else {
				this.comm.DisLink();
				this.comm = null;
				((Button)sender).Text = "连接";
				((Button)sender).ForeColor = Color.Black;
			}
		}

		//重设窗口大小参数
		void SizeReDifine() {
			this.pictureBox1.Width = this.Width - 100;
			WIDTH = this.Width - 100;
			this.pictureBox1.Height = this.Height - 40;
			HEIGTH = this.Height - 40;
		}

		/// 
		/// 更新参数
		/// 
		void UpdateParam() {
			try {
				FRAME_GAP = Convert.ToInt32(textGapFrame.Text);
				FRAME_COUNT = Convert.ToInt32(textFrame.Text);

				VALUE_GAP = Convert.ToInt32(textGapValue.Text);
				MAX_VALUE = Convert.ToInt32(textMaxValue.Text);
				MIN_VALUE = Convert.ToInt32(textMinValue.Text);
			} catch (Exception ex) {
				MessageBox.Show(ex + "");
			}

		}

		/// 
		/// 更新参数 To UI
		/// 
		void UpdateParamBack() {
			try {
				textGapFrame.Text = FRAME_GAP + "";
				textFrame.Text = FRAME_COUNT + "";

				textGapValue.Text = VALUE_GAP + "";
				textMaxValue.Text = MAX_VALUE + "";
				textMinValue.Text = MIN_VALUE + "";
			} catch (Exception ex) {
				MessageBox.Show(ex + "");
			}

		}

		/// 
		/// 更新参数Fix
		/// 
		void UpdateParamFix() {
			try {
				FIX = Convert.ToInt32(textFix1.Text);
				FIX1 = Convert.ToInt32(textFix2.Text);
				FIX2 = Convert.ToInt32(textFix3.Text);
				FIX3 = Convert.ToInt32(textFix4.Text);
				FIX4 = Convert.ToInt32(textFix5.Text);
				FIX5 = Convert.ToInt32(textFix6.Text);
			} catch (Exception ex) {
				MessageBox.Show(ex + "");
			}

		}

		/// 
		/// 更新参数Fix To UI
		/// 
		void UpdateParamBackFix() {
			try {
				textFix1.Text = FIX + "";
				textFix2.Text = FIX1 + "";
				textFix3.Text = FIX2 + "";
				textFix4.Text = FIX3 + "";
				textFix5.Text = FIX4 + "";
				textFix6.Text = FIX5 + "";
			} catch (Exception ex) {
				MessageBox.Show(ex + "");
			}

		}

		/// 
		/// 串口尺寸变化
		/// 
		/// 
		/// 
		private void Form1_Resize(object sender, EventArgs e) {
			SizeReDifine();
		}

		/// 
		/// 更新参数
		/// 
		/// 
		/// 
		private void buttonOK_Click(object sender, EventArgs e) {
			UpdateParam();
		}

		private void buttonFixOK_Click(object sender, EventArgs e) {
			UpdateParamFix();
		}

		//数据显示
		private void checkBox1_CheckedChanged(object sender, EventArgs e) {
			if (sender.Equals(this.checkBox1)) {
				show1 = !show1;
			} else if (sender.Equals(this.checkBox2)) {
				show2 = !show2;
			} else if (sender.Equals(this.checkBox3)) {
				show3 = !show3;
			} else if (sender.Equals(this.checkBox4)) {
				show4 = !show4;
			} else if (sender.Equals(this.checkBox5)) {
				show5 = !show5;
			} else if (sender.Equals(this.checkBox6)) {
				show6 = !show6;
			}
		}

		#endregion 事件处理

	}
}

Frame.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MagicCubeView {

	/// 
	/// 一帧数据
	/// 
	public class Frame {

		public int a;
		public int b;
		public int c;
		public int d;
		public int e;
		public int f;

	}

}

Form1.Designer.cs

namespace MagicCubeView {
	partial class Form1 {
		/// 
		/// 必需的设计器变量。
		/// 
		private System.ComponentModel.IContainer components = null;

		/// 
		/// 清理所有正在使用的资源。
		/// 
		/// 如果应释放托管资源,为 true;否则为 false。
		protected override void Dispose(bool disposing) {
			if (disposing && (components != null)) {
				components.Dispose();
			}
			base.Dispose(disposing);
		}

		#region Windows 窗体设计器生成的代码

		/// 
		/// 设计器支持所需的方法 - 不要
		/// 使用代码编辑器修改此方法的内容。
		/// 
		private void InitializeComponent() {
			this.pictureBox1 = new System.Windows.Forms.PictureBox();
			this.comboBox1 = new System.Windows.Forms.ComboBox();
			this.button2 = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.buttonOK = new System.Windows.Forms.Button();
			this.label5 = new System.Windows.Forms.Label();
			this.textGapFrame = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.textFrame = new System.Windows.Forms.TextBox();
			this.textGapValue = new System.Windows.Forms.TextBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.textMinValue = new System.Windows.Forms.TextBox();
			this.textMaxValue = new System.Windows.Forms.TextBox();
			this.button1 = new System.Windows.Forms.Button();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.buttonFixOK = new System.Windows.Forms.Button();
			this.label6 = new System.Windows.Forms.Label();
			this.textFix5 = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.label8 = new System.Windows.Forms.Label();
			this.textFix4 = new System.Windows.Forms.TextBox();
			this.textFix3 = new System.Windows.Forms.TextBox();
			this.label9 = new System.Windows.Forms.Label();
			this.label10 = new System.Windows.Forms.Label();
			this.textFix2 = new System.Windows.Forms.TextBox();
			this.textFix1 = new System.Windows.Forms.TextBox();
			this.label11 = new System.Windows.Forms.Label();
			this.textFix6 = new System.Windows.Forms.TextBox();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.checkBox1 = new System.Windows.Forms.CheckBox();
			this.checkBox2 = new System.Windows.Forms.CheckBox();
			this.checkBox3 = new System.Windows.Forms.CheckBox();
			this.checkBox4 = new System.Windows.Forms.CheckBox();
			this.checkBox5 = new System.Windows.Forms.CheckBox();
			this.checkBox6 = new System.Windows.Forms.CheckBox();
			((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.SuspendLayout();
			// 
			// pictureBox1
			// 
			this.pictureBox1.Location = new System.Drawing.Point(84, 5);
			this.pictureBox1.Name = "pictureBox1";
			this.pictureBox1.Size = new System.Drawing.Size(1585, 805);
			this.pictureBox1.TabIndex = 3;
			this.pictureBox1.TabStop = false;
			this.pictureBox1.Paint += new System.Windows.Forms.PaintEventHandler(this.pictureBox1_Paint);
			// 
			// comboBox1
			// 
			this.comboBox1.FormattingEnabled = true;
			this.comboBox1.Location = new System.Drawing.Point(3, 34);
			this.comboBox1.Name = "comboBox1";
			this.comboBox1.Size = new System.Drawing.Size(75, 20);
			this.comboBox1.TabIndex = 5;
			// 
			// button2
			// 
			this.button2.Location = new System.Drawing.Point(3, 60);
			this.button2.Name = "button2";
			this.button2.Size = new System.Drawing.Size(75, 23);
			this.button2.TabIndex = 6;
			this.button2.Text = "连接";
			this.button2.UseVisualStyleBackColor = true;
			this.button2.Click += new System.EventHandler(this.button2_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.buttonOK);
			this.groupBox1.Controls.Add(this.label5);
			this.groupBox1.Controls.Add(this.textGapFrame);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.textFrame);
			this.groupBox1.Controls.Add(this.textGapValue);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.textMinValue);
			this.groupBox1.Controls.Add(this.textMaxValue);
			this.groupBox1.Location = new System.Drawing.Point(3, 89);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(75, 278);
			this.groupBox1.TabIndex = 7;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "Param";
			// 
			// buttonOK
			// 
			this.buttonOK.Location = new System.Drawing.Point(13, 244);
			this.buttonOK.Name = "buttonOK";
			this.buttonOK.Size = new System.Drawing.Size(56, 23);
			this.buttonOK.TabIndex = 8;
			this.buttonOK.Text = "OK";
			this.buttonOK.UseVisualStyleBackColor = true;
			this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click);
			// 
			// label5
			// 
			this.label5.AutoSize = true;
			this.label5.Location = new System.Drawing.Point(7, 189);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(41, 12);
			this.label5.TabIndex = 9;
			this.label5.Text = "间隔X:";
			// 
			// textGapFrame
			// 
			this.textGapFrame.Location = new System.Drawing.Point(9, 207);
			this.textGapFrame.Name = "textGapFrame";
			this.textGapFrame.Size = new System.Drawing.Size(58, 21);
			this.textGapFrame.TabIndex = 8;
			// 
			// label3
			// 
			this.label3.AutoSize = true;
			this.label3.Location = new System.Drawing.Point(7, 146);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(65, 12);
			this.label3.TabIndex = 7;
			this.label3.Text = "最大点数X:";
			// 
			// label4
			// 
			this.label4.AutoSize = true;
			this.label4.Location = new System.Drawing.Point(9, 104);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(41, 12);
			this.label4.TabIndex = 6;
			this.label4.Text = "间隔Y:";
			// 
			// textFrame
			// 
			this.textFrame.Location = new System.Drawing.Point(9, 165);
			this.textFrame.Name = "textFrame";
			this.textFrame.Size = new System.Drawing.Size(58, 21);
			this.textFrame.TabIndex = 5;
			// 
			// textGapValue
			// 
			this.textGapValue.Location = new System.Drawing.Point(9, 122);
			this.textGapValue.Name = "textGapValue";
			this.textGapValue.Size = new System.Drawing.Size(58, 21);
			this.textGapValue.TabIndex = 4;
			// 
			// label2
			// 
			this.label2.AutoSize = true;
			this.label2.Location = new System.Drawing.Point(7, 58);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(53, 12);
			this.label2.TabIndex = 3;
			this.label2.Text = "最小值Y:";
			// 
			// label1
			// 
			this.label1.AutoSize = true;
			this.label1.Location = new System.Drawing.Point(7, 16);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(53, 12);
			this.label1.TabIndex = 2;
			this.label1.Text = "最大值Y:";
			// 
			// textMinValue
			// 
			this.textMinValue.Location = new System.Drawing.Point(7, 77);
			this.textMinValue.Name = "textMinValue";
			this.textMinValue.Size = new System.Drawing.Size(58, 21);
			this.textMinValue.TabIndex = 1;
			// 
			// textMaxValue
			// 
			this.textMaxValue.Location = new System.Drawing.Point(7, 34);
			this.textMaxValue.Name = "textMaxValue";
			this.textMaxValue.Size = new System.Drawing.Size(58, 21);
			this.textMaxValue.TabIndex = 0;
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(3, 5);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(75, 23);
			this.button1.TabIndex = 4;
			this.button1.Text = "枚举";
			this.button1.UseVisualStyleBackColor = true;
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label11);
			this.groupBox2.Controls.Add(this.textFix6);
			this.groupBox2.Controls.Add(this.buttonFixOK);
			this.groupBox2.Controls.Add(this.label6);
			this.groupBox2.Controls.Add(this.textFix5);
			this.groupBox2.Controls.Add(this.label7);
			this.groupBox2.Controls.Add(this.label8);
			this.groupBox2.Controls.Add(this.textFix4);
			this.groupBox2.Controls.Add(this.textFix3);
			this.groupBox2.Controls.Add(this.label9);
			this.groupBox2.Controls.Add(this.label10);
			this.groupBox2.Controls.Add(this.textFix2);
			this.groupBox2.Controls.Add(this.textFix1);
			this.groupBox2.Location = new System.Drawing.Point(3, 373);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(75, 300);
			this.groupBox2.TabIndex = 10;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "Fix";
			// 
			// buttonFixOK
			// 
			this.buttonFixOK.Location = new System.Drawing.Point(9, 271);
			this.buttonFixOK.Name = "buttonFixOK";
			this.buttonFixOK.Size = new System.Drawing.Size(56, 23);
			this.buttonFixOK.TabIndex = 8;
			this.buttonFixOK.Text = "OK";
			this.buttonFixOK.UseVisualStyleBackColor = true;
			this.buttonFixOK.Click += new System.EventHandler(this.buttonFixOK_Click);
			// 
			// label6
			// 
			this.label6.AutoSize = true;
			this.label6.Location = new System.Drawing.Point(7, 189);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(35, 12);
			this.label6.TabIndex = 9;
			this.label6.Text = "Fix5:";
			// 
			// textFix5
			// 
			this.textFix5.Location = new System.Drawing.Point(9, 207);
			this.textFix5.Name = "textFix5";
			this.textFix5.Size = new System.Drawing.Size(58, 21);
			this.textFix5.TabIndex = 8;
			// 
			// label7
			// 
			this.label7.AutoSize = true;
			this.label7.Location = new System.Drawing.Point(7, 146);
			this.label7.Name = "label7";
			this.label7.Size = new System.Drawing.Size(35, 12);
			this.label7.TabIndex = 7;
			this.label7.Text = "Fix4:";
			// 
			// label8
			// 
			this.label8.AutoSize = true;
			this.label8.Location = new System.Drawing.Point(9, 104);
			this.label8.Name = "label8";
			this.label8.Size = new System.Drawing.Size(35, 12);
			this.label8.TabIndex = 6;
			this.label8.Text = "Fix3:";
			// 
			// textFix4
			// 
			this.textFix4.Location = new System.Drawing.Point(9, 165);
			this.textFix4.Name = "textFix4";
			this.textFix4.Size = new System.Drawing.Size(58, 21);
			this.textFix4.TabIndex = 5;
			// 
			// textFix3
			// 
			this.textFix3.Location = new System.Drawing.Point(9, 122);
			this.textFix3.Name = "textFix3";
			this.textFix3.Size = new System.Drawing.Size(58, 21);
			this.textFix3.TabIndex = 4;
			// 
			// label9
			// 
			this.label9.AutoSize = true;
			this.label9.Location = new System.Drawing.Point(7, 58);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(35, 12);
			this.label9.TabIndex = 3;
			this.label9.Text = "Fix2:";
			// 
			// label10
			// 
			this.label10.AutoSize = true;
			this.label10.Location = new System.Drawing.Point(7, 16);
			this.label10.Name = "label10";
			this.label10.Size = new System.Drawing.Size(29, 12);
			this.label10.TabIndex = 2;
			this.label10.Text = "Fix1";
			// 
			// textFix2
			// 
			this.textFix2.Location = new System.Drawing.Point(7, 77);
			this.textFix2.Name = "textFix2";
			this.textFix2.Size = new System.Drawing.Size(58, 21);
			this.textFix2.TabIndex = 1;
			// 
			// textFix1
			// 
			this.textFix1.Location = new System.Drawing.Point(7, 34);
			this.textFix1.Name = "textFix1";
			this.textFix1.Size = new System.Drawing.Size(58, 21);
			this.textFix1.TabIndex = 0;
			// 
			// label11
			// 
			this.label11.AutoSize = true;
			this.label11.Location = new System.Drawing.Point(9, 226);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(35, 12);
			this.label11.TabIndex = 11;
			this.label11.Text = "Fix6:";
			// 
			// textFix6
			// 
			this.textFix6.AccessibleRole = System.Windows.Forms.AccessibleRole.PageTabList;
			this.textFix6.Location = new System.Drawing.Point(11, 244);
			this.textFix6.Name = "textFix6";
			this.textFix6.Size = new System.Drawing.Size(58, 21);
			this.textFix6.TabIndex = 10;
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.checkBox6);
			this.groupBox3.Controls.Add(this.checkBox5);
			this.groupBox3.Controls.Add(this.checkBox4);
			this.groupBox3.Controls.Add(this.checkBox3);
			this.groupBox3.Controls.Add(this.checkBox2);
			this.groupBox3.Controls.Add(this.checkBox1);
			this.groupBox3.Location = new System.Drawing.Point(3, 679);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(75, 122);
			this.groupBox3.TabIndex = 12;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "Show";
			// 
			// checkBox1
			// 
			this.checkBox1.AutoSize = true;
			this.checkBox1.Checked = true;
			this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBox1.Location = new System.Drawing.Point(21, 20);
			this.checkBox1.Name = "checkBox1";
			this.checkBox1.Size = new System.Drawing.Size(30, 16);
			this.checkBox1.TabIndex = 0;
			this.checkBox1.Text = "1";
			this.checkBox1.UseVisualStyleBackColor = true;
			this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
			// 
			// checkBox2
			// 
			this.checkBox2.AutoSize = true;
			this.checkBox2.Checked = true;
			this.checkBox2.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBox2.Location = new System.Drawing.Point(21, 36);
			this.checkBox2.Name = "checkBox2";
			this.checkBox2.Size = new System.Drawing.Size(30, 16);
			this.checkBox2.TabIndex = 1;
			this.checkBox2.Text = "2";
			this.checkBox2.UseVisualStyleBackColor = true;
			this.checkBox2.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
			// 
			// checkBox3
			// 
			this.checkBox3.AutoSize = true;
			this.checkBox3.Checked = true;
			this.checkBox3.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBox3.Location = new System.Drawing.Point(21, 52);
			this.checkBox3.Name = "checkBox3";
			this.checkBox3.Size = new System.Drawing.Size(30, 16);
			this.checkBox3.TabIndex = 2;
			this.checkBox3.Text = "3";
			this.checkBox3.UseVisualStyleBackColor = true;
			this.checkBox3.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
			// 
			// checkBox4
			// 
			this.checkBox4.AutoSize = true;
			this.checkBox4.Checked = true;
			this.checkBox4.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBox4.Location = new System.Drawing.Point(21, 68);
			this.checkBox4.Name = "checkBox4";
			this.checkBox4.Size = new System.Drawing.Size(30, 16);
			this.checkBox4.TabIndex = 3;
			this.checkBox4.Text = "4";
			this.checkBox4.UseVisualStyleBackColor = true;
			this.checkBox4.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
			// 
			// checkBox5
			// 
			this.checkBox5.AutoSize = true;
			this.checkBox5.Checked = true;
			this.checkBox5.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBox5.Location = new System.Drawing.Point(21, 84);
			this.checkBox5.Name = "checkBox5";
			this.checkBox5.Size = new System.Drawing.Size(30, 16);
			this.checkBox5.TabIndex = 4;
			this.checkBox5.Text = "5";
			this.checkBox5.UseVisualStyleBackColor = true;
			this.checkBox5.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
			// 
			// checkBox6
			// 
			this.checkBox6.AutoSize = true;
			this.checkBox6.Checked = true;
			this.checkBox6.CheckState = System.Windows.Forms.CheckState.Checked;
			this.checkBox6.Location = new System.Drawing.Point(21, 100);
			this.checkBox6.Name = "checkBox6";
			this.checkBox6.Size = new System.Drawing.Size(30, 16);
			this.checkBox6.TabIndex = 5;
			this.checkBox6.Text = "6";
			this.checkBox6.UseVisualStyleBackColor = true;
			this.checkBox6.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
			// 
			// Form1
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(1343, 811);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.comboBox1);
			this.Controls.Add(this.button1);
			this.Controls.Add(this.pictureBox1);
			this.Name = "Form1";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "Form1";
			this.Resize += new System.EventHandler(this.Form1_Resize);
			((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
			this.groupBox1.ResumeLayout(false);
			this.groupBox1.PerformLayout();
			this.groupBox2.ResumeLayout(false);
			this.groupBox2.PerformLayout();
			this.groupBox3.ResumeLayout(false);
			this.groupBox3.PerformLayout();
			this.ResumeLayout(false);

		}

		#endregion

		private System.Windows.Forms.PictureBox pictureBox1;
		private System.Windows.Forms.ComboBox comboBox1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.TextBox textMinValue;
		private System.Windows.Forms.TextBox textMaxValue;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox textFrame;
		private System.Windows.Forms.TextBox textGapValue;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox textGapFrame;
		private System.Windows.Forms.Button buttonOK;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.Button buttonFixOK;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox textFix5;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Label label8;
		private System.Windows.Forms.TextBox textFix4;
		private System.Windows.Forms.TextBox textFix3;
		private System.Windows.Forms.Label label9;
		private System.Windows.Forms.Label label10;
		private System.Windows.Forms.TextBox textFix2;
		private System.Windows.Forms.TextBox textFix1;
		private System.Windows.Forms.Label label11;
		private System.Windows.Forms.TextBox textFix6;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.CheckBox checkBox6;
		private System.Windows.Forms.CheckBox checkBox5;
		private System.Windows.Forms.CheckBox checkBox4;
		private System.Windows.Forms.CheckBox checkBox3;
		private System.Windows.Forms.CheckBox checkBox2;
		private System.Windows.Forms.CheckBox checkBox1;
	}
}



项目打包:

点击打开链接


你可能感兴趣的:(C#)