您现在的位置是: 软件 > 开发者网络 > 微软开发专栏 > Visual Studio.net专栏 > C#专区 > 正文


-Win xp中的多种网络
-试验试验试验试验
-用Freehand实现位图矢量化
-网络电话面面观

Visual C#的剪切板编程
2002-01-17· ·阿虎··yesky

上一页  1 2 3 4 5  下一页


  四. 程序源代码:

  通过上面的介绍,我们不难理解下面这些程序代码,这些程序代码的功能就是判定当前剪切板中的数据是什么类型。具体如下:

using System ;
using System.Windows.Forms ;
public class MyClipboard
{
public static void Main ( string [ ] args )
{
IDataObject d = Clipboard.GetDataObject ( ) ;

if ( d.GetDataPresent ( DataFormats.Bitmap ) ) {
Console.WriteLine ( "当前剪切板中的数据类型是位图!" ) ;
} else if ( d.GetDataPresent ( DataFormats.Text ) ) {
Console.WriteLine ( "当前剪切板中的数据类型是文本!" ) ;
} else if ( d.GetDataPresent ( DataFormats.Html ) ) {
Console.WriteLine ( "当前剪切板中的数据类型是超文本!" ) ;
} else {
Console.WriteLine ( "当前剪切板中的数据类型是其他类型数据!" ) ;
}
}
}

上一页  1 2 3 4 5  下一页

【责任编辑:方舟】
【发表评论】【关闭窗口】
■ 相关内容
 C#的多线程机制初探
 让窗体飘动起来--C#中Timer组件用法
 微软Visual Studio .NET
 用Visual C#动态生成组件
 .Net平台Windows Forms程序设计简介
 用Visual C#做托盘程序
 用C#实现基于TCP协议的网络通讯
 在C#应用程序中控制输入法
感谢 访问天极网,如果您觉得该文章涉及版权问题,请看这里!