| | | 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 下一页 | | | 感谢
访问天极网,如果您觉得该文章涉及版权问题,请看这里!
|
|