资源简介
C#写的一个例子,正弦波产生,可调采样和频率

代码片段和文件信息
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
//using System.Timers;
namespace TestDemo
{
public partial class Form1 : Form
{
//public float sasa = 500 ;
static private float phase = 0;
private System.Windows.Forms.Timer timer;
private Color colorxx = Color.Yellow;
private int m = 0;
private bool flag = true;
private float f0 = 500;
private float fs = 48000;
public float f2 { get; set; }
public float fs2 { get; set; }
public Form1()
{
this.f2 = 500;
this.fs2 = 48000;
InitializeComponent();
timer = new System.Windows.Forms.Timer();
timer.Interval = 500;
timer.Tick += new EventHandler(timer_Tick);
timer.Start();
timer1.Stop();
// timer.Stop();
}
private void timer_Tick(object sender EventArgs e)
{
int i = 0;
pictureBox1.Invalidate();
}
private void pictureBox1_Paint(object sender PaintEventArgs e)
{
Graphics g = e.Graphics;
Pen pn = new Pen(colorxx2);
//float[] xx = new float[];
// float xx = 0;
// float xx1 = 0;
// PointF[] xy = new PointF[];
// List xy0= null;
PointF[] p = new PointF[490];
List xy = new List();
f0 = this.f2;
fs = this.fs2;
float step = (float)(2.0 * 3.1415926535897 * f0/ fs);
for (int i = 0; i < 490; i++)
{
phase = phase + step;
// p[i].X = i + 30;
//p[i].Y = Convert.ToSingle(210 / 2 * (1 - Math.Sin(2 * i * Math.PI / 30)));
if (phase < -2 * Math.PI)
{
phase = phase + Convert.ToSingle( 2 * Math.PI);
}
if (phase < -2 * Math.PI)
{
phase = phase - Convert.ToSingle(2 * Math.PI);
}
p[i].X = i;
p[i].Y = 100 * (float)Math.Sin(phase) + 100;
}
for (int j = 0; j < 30; j++)
g.DrawLine(new Pen(Color.Gray 1) 0 j * 7 500 j * 7);
for (int j = 0; j < 25; j++)
g.DrawLine(new Pen(Color.Gray 2) j * 20 0 j * 20 200);
g.DrawLine(new Pen(Color.Blue5)0100500100);
g.DrawLine(new Pen(Color.Blue5)000200);
g.DrawLines(pnp);
m++;
}
private void button1_Cli
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-08-08 07:54 TestDemo\
目录 0 2015-08-09 14:22 TestDemo\TestDemo\
文件 914 2015-08-08 07:54 TestDemo\TestDemo.sln
文件 40448 2015-08-11 21:33 TestDemo\TestDemo.v11.suo
文件 187 2015-08-08 07:54 TestDemo\TestDemo\App.config
目录 0 2015-08-08 07:54 TestDemo\TestDemo\bin\
目录 0 2015-08-08 08:02 TestDemo\TestDemo\bin\Debug\
文件 15872 2015-08-11 21:33 TestDemo\TestDemo\bin\Debug\TestDemo.exe
文件 187 2015-08-08 07:54 TestDemo\TestDemo\bin\Debug\TestDemo.exe.config
文件 34304 2015-08-11 21:33 TestDemo\TestDemo\bin\Debug\TestDemo.pdb
文件 22984 2015-08-11 21:33 TestDemo\TestDemo\bin\Debug\TestDemo.vshost.exe
文件 187 2015-08-08 07:54 TestDemo\TestDemo\bin\Debug\TestDemo.vshost.exe.config
文件 490 2012-06-06 02:06 TestDemo\TestDemo\bin\Debug\TestDemo.vshost.exe.manifest
文件 5303 2015-08-10 00:43 TestDemo\TestDemo\Form1.cs
文件 4852 2015-08-10 00:40 TestDemo\TestDemo\Form1.Designer.cs
文件 6211 2015-08-10 00:40 TestDemo\TestDemo\Form1.resx
文件 2854 2015-08-10 00:21 TestDemo\TestDemo\Form2.cs
文件 9470 2015-08-10 00:09 TestDemo\TestDemo\Form2.Designer.cs
文件 5817 2015-08-10 00:07 TestDemo\TestDemo\Form2.resx
目录 0 2015-08-08 07:54 TestDemo\TestDemo\obj\
目录 0 2015-08-11 21:33 TestDemo\TestDemo\obj\Debug\
文件 1278 2015-08-09 08:48 TestDemo\TestDemo\obj\Debug\DesignTimeResolveAssemblyReferences.cache
文件 6867 2015-08-09 14:22 TestDemo\TestDemo\obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
文件 0 2015-08-08 07:54 TestDemo\TestDemo\obj\Debug\TemporaryGeneratedFile_036C0B5B-1481-4323-8D20-8F5ADCB23D92.cs
文件 0 2015-08-08 07:54 TestDemo\TestDemo\obj\Debug\TemporaryGeneratedFile_5937a670-0e60-4077-877b-f7221da3dda1.cs
文件 0 2015-08-08 07:54 TestDemo\TestDemo\obj\Debug\TemporaryGeneratedFile_E7A71F73-0F8D-4B9B-B56E-8E70B10BC5D3.cs
目录 0 2015-08-08 07:54 TestDemo\TestDemo\obj\Debug\TempPE\
文件 727 2015-08-11 21:33 TestDemo\TestDemo\obj\Debug\TestDemo.csproj.FileListAbsolute.txt
文件 1033 2015-08-10 00:40 TestDemo\TestDemo\obj\Debug\TestDemo.csproj.GenerateResource.Cache
文件 2143 2015-08-08 08:02 TestDemo\TestDemo\obj\Debug\TestDemo.csprojResolveAssemblyReference.cache
文件 15872 2015-08-11 21:33 TestDemo\TestDemo\obj\Debug\TestDemo.exe
............此处省略12个文件信息
- 上一篇:WPF实现Expander折叠展开动画
- 下一篇:C# udp服务器收发、点对点收发
相关资源
- C#解析HL7消息的库135797
- C# OCR数字识别实例,采用TessnetOcr,对
- 考试管理系统 - C#源码
- 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#自定义控件
评论
共有 条评论