send emf to clipboard

LaLue

New member
Joined
Dec 19, 2018
Messages
3
Location
Switzerland
Programming Experience
10+
I have written a program with which the user can draw different objects (lines, shapes, font signs). One function is
to select objects and send them as an emf file to the clipboard. The relevant code is :
.

mf = New Metafile(MetafileName, hdc, rectSelected, MetafileFrameUnit.Pixel)

Dim gMetaFile As Graphics = Graphics.FromImage(mf)

gMetaFile.PageUnit = GraphicsUnit.Pixel

Call DrawObjects(gMetaFile, SelectedScreenObjects) ‘ draw the selected objects

FileCollection.Add(MetafileName)

Clipboard.SetFileDropList(FileCollection)



I am working with Win7 and everythings works fine, which means that if I paste the objects e.g. into MS-Word the objects are correctly shown. But as I started to test the program with Win10, and copy/pasted the same objects to MS-Word a much bigger empty rectangle was shown. For the x,y-position of the selection frame (a rectangle which touches the outmost pixels of the selected objects) I used the left upper corner of the drawing surface (a picture box). I noticed that in Win10 you always have to use the left upper corner of the selection frame (x,y-Position = 0,0). After having changed this the objects appear if copy/paste to MS-Word. But still the width and height of the rectangle is much bigger as it should be. I tried to use other graphics unit than GraphicsUnit.Pixel, but this does change nothing.
Would be grateful for any help.
 
Last edited by a moderator:
Back
Top