资源简介
用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 简单示波器
{
public partial class Form1 : Form
{
int type = 0; //决定显示的波型
double range = 10; //显示的波的振幅,初始值为10
double periods = 5; //显示的波的周期,初始值为10
public Form1()
{
InitializeComponent();
}
private void pictureBox1_Paint(object sender PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen mypen=new Pen(Color.Black2);
g.TranslateTransform(this.pictureBox1.Width / 2.0f this.pictureBox1.Height / 2.0f);
g.ScaleTransform(1 -1);//改变坐标
g.DrawLine(mypen -this.pictureBox1.Width / 2.0f 0 this.pictureBox1.Width / 2.0f 0);
g.DrawLine(mypen 0 -this.pictureBox1.Height / 2.0f 0 this.pictureBox1.Height / 2.0f);
//画坐标
g.DrawLine(mypen -5.0f this.pictureBox1.Height / 2.0f - 5.0f 0 this.pictureBox1.Height / 2.0f);
g.DrawLine(mypen 5.0f this.pictureBox1.Height / 2.0f - 5.0f 0 this.pictureBox1.Height / 2.0f);
//画Y方向上的箭头
g.DrawLine(mypen this.pictureBox1.Width / 2.0f - 7.0f 5.0f this.pictureBox1.Width / 2.0f - 3.0f 0);
g.DrawLine(mypen this.pictureBox1.Width / 2.0f - 7.0f -5.0f this.pictureBox1.Width / 2.0f - 3.0f 0);
//画X方向上的箭头
//下面代码中的 251 是由this.pictureBox1.Width / 2.0f取整数得来的。
switch (type)//根据type画不同的波型
{
case 0: //画正弦波
double x1 x2 y1 y2;
for (x1 = -251; x1 <= 251; x1++)
{
y1 = Math.Sin(x1 / periods) * range;
x2 = x1 + 1;
y2 = Math.Sin(x2 / periods) * range;
g.DrawLine(mypen (float)x1 (float)y1 (float)x2 (float)y2);
}
break;
case 1: //画方波
double x3 x4 y;
for (x3 = -251; x3 <= 251; x3++)
{
if (Math.IEEERemainder(x3 periods) > 0 && Math.IEEERemainder(x3 periods) < periods / 2)
y = range;
else
y = -range;
x4 = x3 + 1;
g.DrawLine(mypen (float)x3 (float)y (float)x4 (float)y);
}
break;
case 2: //画三角波
double x;
for (x = -251; x <= 251; x = x + 1)
{
if (Math.IEEERemainder(x periods) == 0)
{
g.DrawLine(mypen (float)x 0 (float)(x + periods / 4) (float)range)
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 13312 2012-06-22 10:47 简单示波器\简单示波器\bin\Debug\简单示波器.exe
文件 32256 2012-06-22 10:47 简单示波器\简单示波器\bin\Debug\简单示波器.pdb
文件 11600 2012-06-22 10:47 简单示波器\简单示波器\bin\Debug\简单示波器.vshost.exe
文件 490 2009-08-31 00:40 简单示波器\简单示波器\bin\Debug\简单示波器.vshost.exe.manifest
文件 4530 2012-06-22 10:51 简单示波器\简单示波器\Form1.cs
文件 11138 2012-06-22 09:42 简单示波器\简单示波器\Form1.Designer.cs
文件 5817 2012-06-22 09:42 简单示波器\简单示波器\Form1.resx
文件 4440 2012-06-22 09:38 简单示波器\简单示波器\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6359 2012-06-22 10:47 简单示波器\简单示波器\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 792 2012-06-22 10:45 简单示波器\简单示波器\obj\x86\Debug\GenerateResource.read.1.tlog
文件 1858 2012-06-22 10:45 简单示波器\简单示波器\obj\x86\Debug\GenerateResource.write.1.tlog
文件 7897 2012-06-22 09:42 简单示波器\简单示波器\obj\x86\Debug\ResolveAssemblyReference.cache
文件 3180 2012-06-22 10:47 简单示波器\简单示波器\obj\x86\Debug\简单示波器.csproj.FileListAbsolute.txt
文件 13312 2012-06-22 10:47 简单示波器\简单示波器\obj\x86\Debug\简单示波器.exe
文件 180 2012-06-22 10:45 简单示波器\简单示波器\obj\x86\Debug\简单示波器.Form1.resources
文件 32256 2012-06-22 10:47 简单示波器\简单示波器\obj\x86\Debug\简单示波器.pdb
文件 180 2012-06-22 10:45 简单示波器\简单示波器\obj\x86\Debug\简单示波器.Properties.Resources.resources
文件 496 2012-06-21 10:35 简单示波器\简单示波器\Program.cs
文件 1362 2012-06-21 10:35 简单示波器\简单示波器\Properties\AssemblyInfo.cs
文件 2880 2012-06-21 10:35 简单示波器\简单示波器\Properties\Resources.Designer.cs
文件 5612 2012-06-21 10:35 简单示波器\简单示波器\Properties\Resources.resx
文件 1100 2012-06-21 10:35 简单示波器\简单示波器\Properties\Settings.Designer.cs
文件 249 2012-06-21 10:35 简单示波器\简单示波器\Properties\Settings.settings
文件 3689 2012-06-21 11:19 简单示波器\简单示波器\简单示波器.csproj
文件 887 2012-06-21 10:35 简单示波器\简单示波器.sln
..A..H. 23552 2012-06-22 10:51 简单示波器\简单示波器.suo
目录 0 2012-06-21 10:35 简单示波器\简单示波器\obj\x86\Debug\TempPE
目录 0 2012-06-22 10:47 简单示波器\简单示波器\obj\x86\Debug
目录 0 2012-06-21 12:33 简单示波器\简单示波器\bin\Debug
目录 0 2012-06-21 12:33 简单示波器\简单示波器\obj\x86
............此处省略8个文件信息
- 上一篇:光功率计上位机C#
- 下一篇:WinCE生成二维码
相关资源
- asp.net C#购物车源代码
- C#实时网络流量监听源码
- C#百度地图源码
- Visual C#.2010从入门到精通配套源程序
- 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#开发实例
- DirectX.Capturec# winform 操作摄像头录像附
- c# 实现的最大最小距离方法对鸢尾花
- C#版保龄球记分代码
- C#自定义控件
- 基于c#的实验室设备管理系统621530
- C# 使用ListView控件实现图片浏览器(源
- C#简单窗体聊天程序
评论
共有 条评论