| |

VerySource

 Forgot password?
 Register
Search
View: 869|Reply: 2

How to copy metafile file to clipboard in .net?

[Copy link]

1

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-1-15 22:40:01
| Show all posts |Read mode
How to copy metafile file to clipboard in .net? When copying to the clipboard, it should be a metafile. The file copied to the clipboard should be able to be copied into Word. Help.
Used in VB 6.0
clipboard.setdata (metafilename, vbCFMetafile) can be implemented, how to achieve it in .net. Thank you.
Reply

Use magic Report

0

Threads

1

Posts

2.00

Credits

Newbie

Rank: 1

Credits
2.00

 China

Post time: 2020-8-21 17:00:02
| Show all posts
// Demonstrates SetData, ContainsData, and GetData.
public Object SwapClipboardFormattedData(String format, Object data)
{
    Object returnObject = null;
    if (System.Windows.Forms.Clipboard.ContainsData(format))
    {
        returnObject = System.Windows.Forms.Clipboard.GetData(format);
        System.Windows.Forms.Clipboard.SetData(format, data);
    }
    return returnObject;
}
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-2 20:00:01
| Show all posts
I didn't understand what it meant. . . You need to know, copy the file in the add folder and paste it into WORD and open it in the drawing and paste it into WORD, WORD can display this picture. . .


Forget it, no matter which one, you have to know the format of the clipboard data. If it is not a predefined format, you should use IDataObject to get the format. The specific implementation is as follows:

Dim iData As IDataObject = Clipboard.GetDataObject.GetFormats

       Dim iData As IDataObject = Clipboard.GetDataObject
        For Each Str As String In iData.GetFormats
            Debug.Print(Str)
        Next
The Str output here is the format string you want to use.
This code can get all the formats in the clipboard. When reading, the iData.GetData method should be used to get the specified format content. If it is copied in the drawing, it should be system.io.memorystaeam.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list