剪贴板复制混合数据 [英] Clipboard Copy mixed data

查看:67
本文介绍了剪贴板复制混合数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨 

我正在编写工具来获取剪贴板并保存以供日后使用。

I am coding a tools to get the Clipboard and save it for later use .

  If My.Computer.Clipboard.ContainsFileDropList Then
            If Not (ISRepeat(type_.FileDropList)) Then Exit Sub
            
            ClipBoardRet(ClipBoardRet.Count - 1).FileDropList = My.Computer.Clipboard.GetFileDropList()
            ClipBoardRet(ClipBoardRet.Count - 1).Type_ = type_.FileDropList
        End If

        If My.Computer.Clipboard.ContainsImage Then
            
            ClipBoardRet(ClipBoardRet.Count - 1).Image_ = My.Computer.Clipboard.GetImage
            ClipBoardRet(ClipBoardRet.Count - 1).Type_ = type_.Image_
        End If

        If My.Computer.Clipboard.ContainsText Then
            If Not (ISRepeat(type_.Text_)) Then Exit Sub
           
            ClipBoardRet(ClipBoardRet.Count - 1).Text_ = My.Computer.Clipboard.GetText()
            ClipBoardRet(ClipBoardRet.Count - 1).Type_ = type_.Text_
        End If

当我尝试从Word或PowerPoint复制某些数据时,会出现问题。

the problem appear when I try to copy some data from Word or PowerPoint.

它是图片和文字的混合数据,有时是带有一些格式的表格。

it is mixed data of Pictures and text and sometimes tables with some Format.

现在当我用它来恢复剪贴板时

now when I use this to restore the clipboard 

Dim index_ As Integer = LB_ClipBoard.SelectedIndex
        Select Case ClipBoardRet_x(index_).Type_
            Case type_.FileDropList
                Clipboard.SetFileDropList(ClipBoardRet_x(index_).FileDropList)
            Case type_.Image_
                Clipboard.SetImage(ClipBoardRet_x(index_).Image_)
            Case type_.Text_
                Clipboard.SetText(ClipBoardRet_x(index_).Text_)
        End Select

所以当我粘贴剪贴板时,我注意到我输了:

so when I paste the clipboard , I note that I lose :

格式

如果混合(图片和文字)会丢失数据

lose data if it mixed ( pictures and text )

Ta bles 

Tables 

所以请任何人都知道解决这个问题的方法。

So please anyone know the way to fix this.

谢谢你先生

推荐答案


所以当我粘贴剪贴板时,我注意到我输了:

so when I paste the clipboard , I note that I lose :

格式

如果数据混合(图片和文字)会丢失数据

lose data if it mixed ( pictures and text )

将项目放回剪贴板时,必须指定数据格式。 如果是标准格式 然后你可以从列表中选择:

https://msdn.microsoft.com/en-us/library/system.windows.clipboard.setdata(v = vs.110).aspx

< a href ="https://msdn.microsoft.com/en-us/library/system.windows.dataformats(v=vs.110).aspx"> https://msdn.microsoft.com/en-us/ library / system.windows.dataformats(v = vs.110).aspx

You have to specify the data format when you place the item back onto the clipboard.  If it is a standard format  then you can select from the list:
https://msdn.microsoft.com/en-us/library/system.windows.clipboard.setdata(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/system.windows.dataformats(v=vs.110).aspx

您可以在剪贴板上放置多个项目(可能是您所指的那个项目)混合文本和imae)但是你应该遵循一些规则。 请参阅:


https://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v = vs.85).aspx

You can place multiple items on the clipboard (which might be what you are referring to as the mixed text and imae) but there are some rules you should follow.  See:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms649013(v=vs.85).aspx

有可能定义您自己的数据格式(可能是一个组合文本和图像的对象),但如果您在不同的应用程序之间进行传输,则不太可能有用。

It is possible to define your own data format (which might be an object that combines text and images) but that is unlikely to be useful if you are doing transfers between different apps.


这篇关于剪贴板复制混合数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆