C#實現(xiàn)從windows剪貼板獲取內(nèi)容的方法
更新時間:2015年05月25日 09:36:25 作者:企鵝不笨
這篇文章主要介紹了C#實現(xiàn)從windows剪貼板獲取內(nèi)容的方法,涉及C#操作剪貼板的相關(guān)技巧,非常簡單實用,需要的朋友可以參考下
本文實例講述了C#實現(xiàn)從windows剪貼板獲取內(nèi)容的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:
using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Data; using System.Windows.Forms; public class MainClass { public static void Main(string[] args) { IDataObject iData = Clipboard.GetDataObject(); if (iData.GetDataPresent(DataFormats.Text)) { Console.WriteLine((String)iData.GetData(DataFormats.Text)); } if (iData.GetDataPresent(DataFormats.Bitmap)) { Image img = (Bitmap)iData.GetData(DataFormats.Bitmap); } } }
希望本文所述對大家的C#程序設(shè)計有所幫助。
相關(guān)文章
c#將字節(jié)數(shù)組轉(zhuǎn)成易讀的字符串的實現(xiàn)
這篇文章主要介紹了c#將字節(jié)數(shù)組轉(zhuǎn)成易讀的字符串的實現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-01-01