📄 form1.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO; //用于文件的操纵
using System.Drawing; //用于绘图
namespace WindowsApplication1
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
///
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.ToolBar toolBar1;
private System.Windows.Forms.ToolBarButton toolBarButton1;
private System.Windows.Forms.ToolBarButton toolBarButton2;
private System.Windows.Forms.ToolBarButton toolBarButton3;
private System.Windows.Forms.ToolBarButton toolBarButton4;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.MenuItem menuItem6;
private System.Windows.Forms.MenuItem menuItem7;
private System.Windows.Forms.MenuItem menuItem8;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.ComponentModel.IContainer components;
string FILE_NAME = "";
FileStream fs;
BinaryReader r;
byte[] head;
byte[] aa;
ushort[] bb;
int channels;
long frequence;
int samplebits;
int datlen;
int dlength;
Graphics g;
private System.Windows.Forms.TextBox textBox1;
private AxMCI.AxMMControl mm1;
private System.Windows.Forms.HScrollBar hScrollBar1;
private System.Windows.Forms.HScrollBar hScrollBar2;
private System.Windows.Forms.PictureBox p1;
private System.Windows.Forms.MenuItem menuItem9;
private System.Windows.Forms.Timer timer1;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TrackBar trackBar1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TrackBar trackBar2;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.ColorDialog colorDialog1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Panel panel3;
Pen pen ;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem6 = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.menuItem7 = new System.Windows.Forms.MenuItem();
this.menuItem8 = new System.Windows.Forms.MenuItem();
this.toolBar1 = new System.Windows.Forms.ToolBar();
this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
this.p1 = new System.Windows.Forms.PictureBox();
this.mm1 = new AxMCI.AxMMControl();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.textBox1 = new System.Windows.Forms.TextBox();
this.hScrollBar1 = new System.Windows.Forms.HScrollBar();
this.hScrollBar2 = new System.Windows.Forms.HScrollBar();
this.timer1 = new System.Windows.Forms.Timer(this.components);
this.panel1 = new System.Windows.Forms.Panel();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label1 = new System.Windows.Forms.Label();
this.button1 = new System.Windows.Forms.Button();
this.trackBar1 = new System.Windows.Forms.TrackBar();
this.panel2 = new System.Windows.Forms.Panel();
this.button2 = new System.Windows.Forms.Button();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.trackBar2 = new System.Windows.Forms.TrackBar();
this.colorDialog1 = new System.Windows.Forms.ColorDialog();
this.label5 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.panel3 = new System.Windows.Forms.Panel();
((System.ComponentModel.ISupportInitialize)(this.mm1)).BeginInit();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar1)).BeginInit();
this.panel2.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.trackBar2)).BeginInit();
this.panel3.SuspendLayout();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem4,
this.menuItem7});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem2,
this.menuItem3});
this.menuItem1.Text = "文件";
//
// menuItem2
//
this.menuItem2.Index = 0;
this.menuItem2.Text = "打开";
this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
//
// menuItem3
//
this.menuItem3.Index = 1;
this.menuItem3.Text = "关闭";
this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
//
// menuItem4
//
this.menuItem4.Index = 1;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem5,
this.menuItem6,
this.menuItem9});
this.menuItem4.Text = "控制";
//
// menuItem5
//
this.menuItem5.Index = 0;
this.menuItem5.Text = "播放";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem6
//
this.menuItem6.Index = 1;
this.menuItem6.Text = "图像";
this.menuItem6.Click += new System.EventHandler(this.menuItem6_Click);
//
// menuItem9
//
this.menuItem9.Index = 2;
this.menuItem9.Text = "跳动的图像";
this.menuItem9.Click += new System.EventHandler(this.menuItem9_Click);
//
// menuItem7
//
this.menuItem7.Index = 2;
this.menuItem7.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem8});
this.menuItem7.Text = "帮助";
//
// menuItem8
//
this.menuItem8.Index = 0;
this.menuItem8.Text = "介绍";
//
// toolBar1
//
this.toolBar1.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
this.toolBarButton1,
this.toolBarButton2,
this.toolBarButton3,
this.toolBarButton4});
this.toolBar1.DropDownArrows = true;
this.toolBar1.Location = new System.Drawing.Point(0, 0);
this.toolBar1.Name = "toolBar1";
this.toolBar1.ShowToolTips = true;
this.toolBar1.Size = new System.Drawing.Size(728, 41);
this.toolBar1.TabIndex = 0;
this.toolBar1.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar1_ButtonClick);
//
// toolBarButton1
//
this.toolBarButton1.Text = "打开";
//
// toolBarButton2
//
this.toolBarButton2.Text = "图画";
//
// toolBarButton3
//
this.toolBarButton3.Text = "播放";
//
// toolBarButton4
//
this.toolBarButton4.Text = "退出";
//
// p1
//
this.p1.Location = new System.Drawing.Point(8, 120);
this.p1.Name = "p1";
this.p1.Size = new System.Drawing.Size(696, 128);
this.p1.TabIndex = 1;
this.p1.TabStop = false;
this.p1.Click += new System.EventHandler(this.pictureBox1_Click);
//
// mm1
//
this.mm1.Enabled = true;
this.mm1.Location = new System.Drawing.Point(0, 48);
this.mm1.Name = "mm1";
this.mm1.OcxState = ((System.Windows.Forms.AxHost.State)(resources.GetObject("mm1.OcxState")));
this.mm1.Size = new System.Drawing.Size(236, 23);
this.mm1.TabIndex = 2;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(240, 48);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(168, 21);
this.textBox1.TabIndex = 3;
this.textBox1.Text = "";
//
// hScrollBar1
//
this.hScrollBar1.Location = new System.Drawing.Point(64, 8);
this.hScrollBar1.Maximum = 1000;
this.hScrollBar1.Minimum = 200;
this.hScrollBar1.Name = "hScrollBar1";
this.hScrollBar1.TabIndex = 4;
this.hScrollBar1.Value = 200;
this.hScrollBar1.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar1_Scroll);
//
// hScrollBar2
//
this.hScrollBar2.Location = new System.Drawing.Point(216, 8);
this.hScrollBar2.Maximum = 500000;
this.hScrollBar2.Minimum = 10000;
this.hScrollBar2.Name = "hScrollBar2";
this.hScrollBar2.TabIndex = 5;
this.hScrollBar2.Value = 10000;
this.hScrollBar2.Scroll += new System.Windows.Forms.ScrollEventHandler(this.hScrollBar2_Scroll);
//
// timer1
//
this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
//
// panel1
//
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Location = new System.Drawing.Point(8, 208);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(592, 328);
this.panel1.TabIndex = 6;
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(592, 328);
this.pictureBox1.TabIndex = 0;
this.pictureBox1.TabStop = false;
this.pictureBox1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox1_MouseDown);
//
// label1
//
this.label1.Location = new System.Drawing.Point(8, 192);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(100, 16);
this.label1.TabIndex = 7;
this.label1.Text = "绘图区:";
//
// button1
//
this.button1.Location = new System.Drawing.Point(616, 216);
this.button1.Name = "button1";
this.button1.TabIndex = 8;
this.button1.Text = "清屏";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// trackBar1
//
this.trackBar1.Location = new System.Drawing.Point(0, 32);
this.trackBar1.Name = "trackBar1";
this.trackBar1.Size = new System.Drawing.Size(112, 45);
this.trackBar1.TabIndex = 9;
//
// panel2
//
this.panel2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel2.Controls.Add(this.button2);
this.panel2.Controls.Add(this.label4);
this.panel2.Controls.Add(this.label3);
this.panel2.Controls.Add(this.label2);
this.panel2.Controls.Add(this.trackBar1);
this.panel2.Controls.Add(this.trackBar2);
this.panel2.Location = new System.Drawing.Point(608, 280);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(112, 256);
this.panel2.TabIndex = 10;
//
// button2
//
this.button2.Location = new System.Drawing.Point(16, 144);
this.button2.Name = "button2";
this.button2.TabIndex = 13;
this.button2.Text = "修改画笔颜色";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// label4
//
this.label4.Location = new System.Drawing.Point(64, 72);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(48, 23);
this.label4.TabIndex = 12;
this.label4.Text = "1";
//
// label3
//
this.label3.Location = new System.Drawing.Point(8, 72);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(64, 23);
this.label3.TabIndex = 11;
this.label3.Text = "画笔大小:";
//
// label2
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -