资源简介
简单设计的一个基于winform的串口助手,包括了波形显示功能,数据的发送与接收。是当初初学C#时做的一个小东西

代码片段和文件信息
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;
namespace Drawer
{
public partial class Drawer : Form
{
private const int Unit_length = 32;//单位格大小
private int DrawStep = 8;//默认绘制单位
private const int Y_Max = 512;//Y轴最大数值
private const int MaxStep = 33;//绘制单位最大值
private const int MinStep = 1;//绘制单位最小值
private const int StartPrint = 32;//点坐标偏移量
private List DataList = new List();//数据结构----线性链表
private Pen TablePen = new Pen(Color.FromArgb(0x00 0x00 0x00));//轴线颜色
private Pen LinesPen = new Pen(Color.FromArgb(0xa0 0x00 0x00));//波形颜色
public ShowWindow ShowMainWindow;//定义显示主窗口委托访问权限为public
public HideWindow HideMainWindow;//定义隐藏主窗口委托
public OpenPort OpenSerialPort;//定义打开串口委托
public ClosePort CloseSerialPort;//定义关闭串口委托
public GetMainPos GetMainPos;//定义获取主窗口信息委托(自动对齐)
public GetMainWidth GetMainWidth;//定义获取主窗口宽度(自动对齐)
private bool KeyShift KeyShowMain KeyHideMain KeyExit KeyOpen KeyClose KeyStepUp KeyStepDown;
public Drawer()
{
this.Setstyle(Controlstyles.DoubleBuffer | Controlstyles.UserPaint |
Controlstyles.AllPaintingInWmPaint
true);//开启双缓冲
this.Updatestyles();
InitializeComponent();
}
public void AddData(byte[] Data)
{
for (int i = 0; i < Data.Length;i++ )
DataList.Add(Data[i]);//链表尾部添加数据
Invalidate();//刷新显示
}
private void Form1_Paint(object sender PaintEventArgs e)//画
{
String Str = ““;
System.Drawing.Drawing2D.GraphicsPath gp = new System.Drawing.Drawing2D.GraphicsPath();
e.Graphics.FillRectangle(Brushes.White e.Graphics.ClipBounds);
//Draw Y 纵向轴绘制
for (int i = 0; i <= this.ClientRectangle.Width / Unit_length; i++)
{
e.Graphics.DrawLine(TablePen StartPrint + i * Unit_length StartPrint StartPrint + i * Unit_length StartPrint + Y_Max);//画线
gp.AddString((i * (Unit_length / DrawStep)).ToString() this.Font.FontFamily (int)Fontstyle.Regular 12 new RectangleF(StartPrint + i * Unit_length - 7this.ClientRectangle.Height-StartPrint + 4 400 50) null);//添加文字
}
//Draw X 横向轴绘制
for (int i = 0; i <= this.ClientRectangle.Height / Unit_length; i++)
{
e.Graphics.DrawLine(TablePen StartPrint (i + 1) * Unit_length this.ClientRectangle.Width (i + 1) * Unit_length);//画线
Str = ((16 - i) * 16).ToString(“X“);
Str = “0x“ + (Str.Length == 1 ? Str + “0“ : Str);
if (i == 0)
Str = “0xFF“
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2017-12-29 16:12 串口助手波形显示\
目录 0 2017-12-29 16:12 串口助手波形显示\.vs\
目录 0 2017-12-29 16:12 串口助手波形显示\.vs\Drawer\
目录 0 2017-12-29 16:12 串口助手波形显示\.vs\Drawer\v14\
文件 65024 2017-12-29 21:13 串口助手波形显示\.vs\Drawer\v14\.suo
目录 0 2017-12-29 21:10 串口助手波形显示\Drawer\
文件 908 2013-12-01 14:39 串口助手波形显示\Drawer.sln
文件 59904 2014-01-14 23:18 串口助手波形显示\Drawer.v11.suo
文件 16958 2017-12-29 16:48 串口助手波形显示\Drawer\123.ico
目录 0 2017-12-29 16:12 串口助手波形显示\Drawer\bin\
目录 0 2017-12-29 16:46 串口助手波形显示\Drawer\bin\Debug\
文件 16958 2017-12-11 15:27 串口助手波形显示\Drawer\bin\Debug\123.ico
文件 20992 2013-12-08 13:45 串口助手波形显示\Drawer\bin\Debug\Drawer.exe
文件 42496 2013-12-08 13:45 串口助手波形显示\Drawer\bin\Debug\Drawer.pdb
文件 22472 2014-01-14 22:54 串口助手波形显示\Drawer\bin\Debug\Drawer.vshost.exe
文件 67646 2017-12-11 13:11 串口助手波形显示\Drawer\bin\Debug\ooopic_1512968849.ico
目录 0 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\
目录 0 2017-12-29 16:12 串口助手波形显示\Drawer\bin\Release\abc\
文件 8692 2014-01-14 22:55 串口助手波形显示\Drawer\bin\Release\abc.zip
文件 19456 2014-01-14 22:50 串口助手波形显示\Drawer\bin\Release\abc\Drawer.exe
目录 0 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\app.publish\
文件 157616 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\app.publish\Drawer.exe
文件 5736 2013-12-08 09:58 串口助手波形显示\Drawer\bin\Release\code.c
文件 1805 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.application
文件 156672 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.exe
文件 3849 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.exe.manifest
文件 34304 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.pdb
文件 1805 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.vshost.application
文件 22688 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.vshost.exe
文件 3849 2017-12-29 21:10 串口助手波形显示\Drawer\bin\Release\Drawer.vshost.exe.manifest
文件 9314 2014-01-14 23:04 串口助手波形显示\Drawer\Drawer.cs
............此处省略47个文件信息
相关资源
- C# IP地址输入控件
- C#在一个窗口刷新更改另一个窗口控件
- C# TIP文件生成和拆解
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- Winform可视化打印模板设计工具含源码
- C# 软件版本更新
- C#屏幕软键盘源码,可以自己定制界面
- 智慧城市 智能家居 C# 源代码
- c#获取mobile手机的IMEI和IMSI
- C#实现简单QQ聊天程序
- 操作系统 模拟的 欢迎下载 C#版
- C#写的计算机性能监控程序
- 用C#实现邮件发送,有点类似于outlo
- MVC model层代码生成器 C#
- c#小型图书销售系统
- C# Socket Server Client 通讯应用 完整的服
- c# winform 自动登录 百度账户 源代码
- C#编写的16进制计算器
- C#TCP通信协议
- C# 数据表(Dataset)操作 合并 查询一
- C#语音识别系统speechsdk51,SpeechSDK51L
- 数据库备份还原工具1.0 C# 源码
-
[免费]xm
lDocument 节点遍历C# - EQ2008LEDc#开发实例
评论
共有 条评论