110,538
社区成员
发帖
与我相关
我的任务
分享
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace ConsoleApplication2
{
class Program
{
static void Main(string[] args)
{
System.Windows.Forms.IDataObject iData = System.Windows.Forms.Clipboard.GetDataObject();
String html = "";
if (iData != null)
{
if (iData.GetDataPresent(DataFormats.Html))
{
html = (String)iData.GetData(DataFormats.Html);
}
else
{
if (iData.GetDataPresent(DataFormats.Text))
{
html = (String)iData.GetData(DataFormats.Text);
}
else
{
html = "剪贴板数据格式不正确。";
}
}
}
else {
html = "null";
}
Console.WriteLine(html);
Console.Read();
}
}
}