开发者

I'm using Clipboard.GetDataObject(); but sometimes it does not function like I need

This is the function I'm using

    public String ClipboardGet()
    {
        IDataObject dataObj = Clipboard.GetDataObject();

        if (!dataObj.GetDataPre开发者_StackOverflow社区sent(DataFormats.Text))
            return "";

        return dataObj.GetData(DataFormats.Text).ToString();
    }

but sometimes it returns a empty string even when the data is text, how to handel this?


Have you tried Clipboard.GetText or IDataObject.GetDataPresent(string, bool)?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜