截屏2版

/*
这是升级版的,花纯春截屏器了哈,比昨天哪个多了,在系统托盘图标上的右键弹出菜单操作,就不会将程序本身给显示在截出来的图片上了。而且修正了昨天那个显示图片不全毛病。
可以从这儿下载http://metababy.chinay.com/sp/metababy/08503052753.rar
后几天,逐步完善其他功能。
*/
using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace 截屏
{
 /// <summary>
 /// Form1 的摘要说明。
 /// </summary>
 public class Form1 : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.TextBox textBox1;
  private System.Windows.Forms.Label label1;
  private System.Windows.Forms.LinkLabel linkLabel1;
  private System.Windows.Forms.LinkLabel linkLabel2;
  private System.Windows.Forms.LinkLabel linkLabel3;
  private System.Windows.Forms.LinkLabel linkLabel4;
  private System.Windows.Forms.NotifyIcon notifyIcon1;
  private System.ComponentModel.IContainer components;
  private ContextMenu notifyiconMnu;

  public Form1()
  {
   //
   // Windows 窗体设计器支持所必需的
   //
   InitializeComponent();

   //
   // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
   //
  }

  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void Dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.Dispose();
    }
   }
   base.Dispose( disposing );
  }
[ System.Runtime.InteropServices.DllImportAttribute ( "gdi32.dll" ) ]
  private static extern bool BitBlt (
 IntPtr hdcDest , // 目标 DC的句柄
 int nXDest ,
 int nYDest , 
 int nWidth ,
 int nHeight ,
 IntPtr hdcSrc ,  // 源DC的句柄
 int nXSrc ,
 int nYSrc ,
 System.Int32 dwRop  // 光栅的处理数值
 ) ;//这儿,我也没搞清楚,知其然不知所以然,这些参数的具体意义,我还得找找资料,有朋友知道的,请回复在评论里,谢谢
  //今天,我也在网上找了,没有找到解释。只有死记吧,搜出来结果,都是只是在用,代码也是一样的,没有解释原因的,算了,读书要“不求甚解”嘛,不然,就学不起走了,今后,时机到了,总会在“不经意间”知道为什么要这样用的。
  
  [ System.Runtime.InteropServices.DllImportAttribute ( "gdi32.dll" ) ]//这是原来没有的一段,就是这个造成了截图不全
  private static extern IntPtr CreateDC (
   string lpszDriver , // 驱动名称
   string lpszDevice , // 设备名称
   string lpszOutput , // 无用,可以设定位"NULL"
   IntPtr lpInitData // 任意的打印机数据
   ) ;

  #region Windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void InitializeComponent()
  {
   this.components = new System.ComponentModel.Container();
   System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
   this.button1 = new System.Windows.Forms.Button();
   this.textBox1 = new System.Windows.Forms.TextBox();
   this.label1 = new System.Windows.Forms.Label();
   this.linkLabel1 = new System.Windows.Forms.LinkLabel();
   this.linkLabel2 = new System.Windows.Forms.LinkLabel();
   this.linkLabel3 = new System.Windows.Forms.LinkLabel();
   this.linkLabel4 = new System.Windows.Forms.LinkLabel();
   this.notifyIcon1 = new System.Windows.Forms.NotifyIcon(this.components);
   this.SuspendLayout();
   //
   // button1
   //
   this.button1.Location = new System.Drawing.Point(24, 120);
   this.button1.Name = "button1";
   this.button1.TabIndex = 0;
   this.button1.Text = "截屏";
   this.button1.Click += new System.EventHandler(this.button1_Click);
   //
   // textBox1
   //
   this.textBox1.Location = new System.Drawing.Point(24, 64);
   this.textBox1.Name = "textBox1";
   this.textBox1.Size = new System.Drawing.Size(184, 21);
   this.textBox1.TabIndex = 1;
   this.textBox1.Text = "c://花纯春.jpg";
   //
   // label1
   //
   this.label1.Location = new System.Drawing.Point(24, 40);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(168, 23);
   this.label1.TabIndex = 2;
   this.label1.Text = "请输入图片存放位置及名称";
   //
   // linkLabel1
   //
   this.linkLabel1.Location = new System.Drawing.Point(24, 176);
   this.linkLabel1.Name = "linkLabel1";
   this.linkLabel1.TabIndex = 3;
   this.linkLabel1.TabStop = true;
   this.linkLabel1.Text = "我的小店";
   this.linkLabel1.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);
   //
   // linkLabel2
   //
   this.linkLabel2.Location = new System.Drawing.Point(136, 176);
   this.linkLabel2.Name = "linkLabel2";
   this.linkLabel2.TabIndex = 4;
   this.linkLabel2.TabStop = true;
   this.linkLabel2.Text = "我的blog主力站";
   this.linkLabel2.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel2_LinkClicked);
   //
   // linkLabel3
   //
   this.linkLabel3.Location = new System.Drawing.Point(24, 224);
   this.linkLabel3.Name = "linkLabel3";
   this.linkLabel3.TabIndex = 5;
   this.linkLabel3.TabStop = true;
   this.linkLabel3.Text = "我的blog备用站";
   this.linkLabel3.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel3_LinkClicked);
   //
   // linkLabel4
   //
   this.linkLabel4.Location = new System.Drawing.Point(136, 224);
   this.linkLabel4.Name = "linkLabel4";
   this.linkLabel4.TabIndex = 6;
   this.linkLabel4.TabStop = true;
   this.linkLabel4.Text = "我的MSN空间";
   this.linkLabel4.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel4_LinkClicked);
   //
   // notifyIcon1,系统托盘图标,新加的
   //
   this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
   this.notifyIcon1.Text = "花纯春截屏器";
   this.notifyIcon1.Visible = true;
   //定义一个MenuItem数组,并把此数组同时赋值给ContextMenu对象
   MenuItem[] mnuItms = new MenuItem [3];
   mnuItms [ 0 ] = new MenuItem ( ) ;
   mnuItms [ 0 ] .Text = "捕获当前屏幕!" ;
   mnuItms [ 0 ] .Click += new System.EventHandler ( this.button1_Click ) ;
   mnuItms [ 1 ] = new MenuItem ( "-" ) ;
   mnuItms [ 2 ] = new MenuItem ( ) ;
   mnuItms [ 2 ] .Text = "退出系统" ;
   mnuItms [ 2 ] .Click += new System.EventHandler ( this.ExitSelect ) ;
   mnuItms [ 2 ] .DefaultItem = true ;
   notifyiconMnu = new ContextMenu ( mnuItms ) ;
   notifyIcon1.ContextMenu = notifyiconMnu ;//新加的右键菜单
   //为托盘程序加入设定好的ContextMenu对象

   //
   // Form1
   //
   this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
   this.ClientSize = new System.Drawing.Size(292, 266);
   this.Controls.Add(this.linkLabel4);
   this.Controls.Add(this.linkLabel3);
   this.Controls.Add(this.linkLabel2);
   this.Controls.Add(this.linkLabel1);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.textBox1);
   this.Controls.Add(this.button1);
   this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
   this.Name = "Form1";
   this.Text = "花纯春写的截屏练习程序";
   this.ResumeLayout(false);

  }
  #endregion

  /// <summary>
  /// 应用程序的主入口点。
  /// </summary>
  [STAThread]
  static void Main()
  {
   Application.Run(new Form1());
  }

  private void button1_Click(object sender, System.EventArgs e)
  {
   this.Visible = false ;//这是新加的

   try
   {
     IntPtr dc1 = CreateDC ( "DISPLAY" , null , null , ( IntPtr ) null ) ;
    //创建显示器的DC,这也是后来才加的,原来没有此句


  
    //获得当前屏幕的大小
    Rectangle rect = new Rectangle ( ) ;
    rect = Screen.GetWorkingArea ( this ) ;
    //创建一个以当前屏幕为模板的图象
    Graphics g1 = this.CreateGraphics ( ) ;
    //创建以屏幕大小为标准的位图
    Image MyImage = new Bitmap ( rect.Width , rect.Height , g1 ) ;
    Graphics g2 = Graphics.FromImage ( MyImage ) ;
    //得到屏幕的DC
    IntPtr dc3 = g1.GetHdc ( ) ;
    //得到Bitmap的DC
    IntPtr dc2 = g2.GetHdc ( ) ;
    //调用此API函数,实现屏幕捕获
    BitBlt ( dc2 , 0 , 0 , rect.Width , rect.Height , dc1 , 0 , 0 , 13369376 ) ;
    //释放掉屏幕的DC
    g1.ReleaseHdc ( dc3 ) ;//这是后来才改的,以来的为g1.ReleaseHdc(dc1);
    //释放掉Bitmap的DC
    g2.ReleaseHdc ( dc2 ) ;
    //以JPG文件格式来保存
    MyImage.Save ( textBox1.Text ,ImageFormat.Jpeg);
    string a="当前屏幕已经保存到"+textBox1.Text;
    MessageBox.Show ( a ) ;
    this.Visible = true ;//这是新加的
   }
   catch{MessageBox.Show("出错!");}
  }
  public void ExitSelect ( object sender , System.EventArgs e )
  {
   //隐藏托盘程序中的图标
   notifyIcon1.Visible = false ;
   //关闭系统
   this.Close ( ) ;
  }


  private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
  {
   System.Diagnostics.Process.Start("http://shop1471977.taobao.com");

  }

  private void linkLabel2_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
  {
   System.Diagnostics.Process.Start("http://riji.163.com/weblog/page/metababy");

  }

  private void linkLabel3_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
  {
   System.Diagnostics.Process.Start("http://blog.csdn.net/metababy");

  }

  private void linkLabel4_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
  {
   System.Diagnostics.Process.Start("http://spaces.msn.com/members/metababy");

  }
 }
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
【标题】"语音识别的一个matlab程序"是一个与语音处理和模式识别技术相关的项目,它使用MATLAB编程语言实现。MATLAB是MathWorks公司开发的一种数值计算和数据可视化环境,广泛应用于工程、科学和数学领域,尤其在信号处理和机器学习方面有很强的功能。 【描述】提到的"在一个网站看到,大家分享一下"表明这是一个社区共享的资源,可能来源于一个在线论坛或编程交流平台。这样的共享行为旨在促进技术交流和学习,让其他对语音识别感兴趣的用户能够参考、学习和改进代码。 【标签】"语音识别"是这个项目的关键词,意味着该程序涉及将人类语音转化为文本或命令的过程。语音识别技术的核心是将音频信号转换为可理解的数据,这通常包括预处理、特征提取、模型训练和匹配等步骤。 在提供的【压缩包子文件的文件名称列表】中,我们可以推断出这个MATLAB程序的组成部分: 1. `demo.m`:通常是演示脚本,用于展示程序的主要功能和用法,用户可以通过运行这个文件快速了解程序的工作原理。 2. `.p` 文件(melfb.p, mfcc.p, vqlbg.p, disteu.p, test.p, blockFrames.p, train.p):这些是MATLAB的编译函数文件,可能包含特定的算法实现,如梅尔频率倒谱系数(MFCC)提取、声学建模、距离计算、训练和测试等功能。例如: - `melfb.p` 可能实现了梅尔滤波器组,用于对语音信号进行频谱分析。 - `mfcc.p` 可能负责MFCC的计算,这是语音识别中常用的特征提取方法。 - `train.p` 和 `test.p` 可能分别对应模型的训练和测试过程。 3. `Read Me.txt`:通常包含关于如何使用、配置和运行程序的说明和指导。 4. `www.pudn.com.txt`:可能指向源文件的下载地址或发布者的信息,PUDN(太平洋下载网)是一个提供各类资源下载的网站。 这个MATLAB程序可能涵盖了语音识别的完整流程,包括预处理、特征提取、模型训练和评估。通过运行`demo.m`,用户可以体验整个识别过程,并可根据源代码深入了解语音识别的实现细节。对于学习和研究语音识别技术的人来说,这是一个宝贵的实践资源。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值