当前位置:首页
开发技术指南» 文章正文
    引言:
 

 

    摘要: 在win98下访问win2000的c$为什么不能访问?在2000下可以访问,提示密码错误,但肯定是不错的。 ......
 ·查blob字段,在线等待。    »显示摘要«
    摘要: 我把一个文本存入数据库中,字段设为blob,用什么办法能够看出我的东西是否已经存入数据库中了,这个字段的大小是多少,用sqlplus可以实现吗? ......


如何读取当前剪切板中数据内容并保存

如何读取当前剪切板中数据内容并保存?

NO.1   作者: zhuohs

这里有个完整的程序,你试试看:  
   
  using   System   ;  
  using   System.Drawing   ;  
  using   System.Collections   ;  
  using   System.ComponentModel   ;  
  using   System.Windows.Forms   ;  
  using   System.Data;  
  public   class   Form1   :   Form  
  {  
  private   RichTextBox   richTextBox1   ;  
  private   Button   button1   ;  
  private   System.ComponentModel.Container   components   =   null   ;  
  public   Form1()  
  {  
  //初始化窗体中的各个组件  
  InitializeComponent   (   )   ;  
  }  
  //清除程序中使用过的资源  
  protected   override   void   Dispose   (   bool   disposing   )  
  {  
  if   (   disposing   )  
  {  
  if   (   components   !=   null   )    
  {  
  components.Dispose   (   )   ;  
  }  
  }  
  base.Dispose   (   disposing   );  
  }  
  private   void   InitializeComponent   (   )  
  {  
  this.richTextBox1   =   new   RichTextBox   (   )   ;  
  this.button1   =   new   Button   (   )   ;  
  this.SuspendLayout   (   )   ;  
   
  this.richTextBox1.Location   =   new   System.Drawing.Point   (   40   ,   16   )   ;  
  this.richTextBox1.Name   =   "richTextBox1"   ;  
  this.richTextBox1.Size   =   new   System.Drawing.Size   (   336   ,   264   )   ;  
  this.richTextBox1.TabIndex   =   0   ;  
  this.richTextBox1.Text   =   ""   ;  
   
  this.button1.Location   =   new   System.Drawing.Point   (   128   ,   304   )   ;  
  this.button1.Name   =   "button1"   ;  
  this.button1.Size   =   new   System.Drawing.Size   (   128   ,   24   )   ;  
  this.button1.TabIndex   =   1   ;  
  this.button1.Text   =   "获得剪切板中的数据"   ;  
  this.button1.Click   +=   new   System.EventHandler   (   this.button1_Click   )   ;  
   
  this.AutoScaleBaseSize   =   new   System.Drawing.Size   (   6   ,   14   )   ;  
  this.ClientSize   =   new   System.Drawing.Size   (   408   ,   357   )   ;  
  this.Controls.Add   (   button1   );  
  this.Controls.Add   (   richTextBox1   );  
  this.Name   =   "Form1";  
  this.Text   =   "用Visual   C#来保存剪切板中的数据!";  
  this.ResumeLayout(false);  
   
  }  
  static   void   Main   (   )    
  {  
  Application.Run   (   new   Form1   (   )   )   ;  
  }  
  private   void   button1_Click   (   object   sender   ,   System.EventArgs   e   )  
  {   //定义一个IDataObject接口  
  IDataObject   d   =   Clipboard.GetDataObject   (   )   ;  
  //如果剪切板中数据是位图,则另存为C盘的my.bmp文件  
  if   (   d.GetDataPresent   (   DataFormats.Bitmap   )   )    
  {  
  //出箱  
  Bitmap   b   =   (   Bitmap   )   d.GetData   (   DataFormats.Bitmap   )   ;  
  b.Save   (   @"c:\my.bmp"   )   ;  
  MessageBox.Show   (   "当前剪切板内容是位图,已经保存到"MY.BMP"文件中!"   )   ;  
  }   //如果是文本,则用窗体中的RichText组件显示文本内容。  
  else   if   (   d.GetDataPresent   (   DataFormats.Text   )   )    
  {  
  //出箱  
  String   c   =   (   String   )   d.GetData   (   DataFormats.Text   )   ;    
  richTextBox1.Text   =   c   ;  
  }    
  else    
  {  
  MessageBox.Show   (   "剪切板中是其他类型的数据!"   )   ;  
  }  
  }  
  }


 ·十分简单的问题    »显示摘要«
    摘要: 有个框架网页如图所示,即上方是一个目录,点击链接后改变下面的网页。 下面是一个框架网页,点击左边链接能改变右边页面。我想点击上方的某些链接可以改变下面整个框架网页,而有的链接只改变下面框架的右方网页。应该怎么做? 我是菜鸟,希望说得详细些。谢谢! ----------------------------------------- -------------------------......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE