Visio Shape in Clipboard

A

Anne Nonyme

Hello,
I wand to get out a Visio Shape from the clipboard (c#).

IDataObject data = Clipboard.GetDataObject();
System.IO.MemoryStream l_MemStream = (System.IO.MemoryStream)data.GetData
("Visio 11.0 Shapes");

How to re-create a Shape from this MemoryStream ?

I try to do :

data.GetData (typeof(Microsoft.Office.Interop.Visio.ShapeClass))

but returns null.

Thanks
Anne
 
C

Chris Roth [ Visio MVP ]

I'm not 100% sure about this, after reading a paragraph in Wideman's book,
but I think you need to somehow query the clipboard to find out the ID of
"Visio 11.0 Shapes", then use that ID in the GetData function. The ID may
change from windows session to session.

--

Hope this helps,

Chris Roth
Visio MVP
 
A

Anne Nonyme

Thanks for answer, but I don't understant it...

The problem is : how to re-create a Shape from the MemoryStream ?

IDataObject data = Clipboard.GetDataObject();
MemoryStream l_MemStream = (MemoryStream)data.GetData ("Visio 11.0 Shapes");

Thanks
Anne
 
C

Chris Roth [ Visio MVP ]

How about something like this:

IDataObject ido = Clipboard.GetDataObject();

Visio.ActivePage.Drop( ido.GetData( "Visio 11.0 Shapes" ), 0, 0 );


--

Hope this helps,


Chris Roth
Visio MVP


Anne Nonyme said:
Thanks for answer, but I don't understant it...

The problem is : how to re-create a Shape from the MemoryStream ?

IDataObject data = Clipboard.GetDataObject();
MemoryStream l_MemStream = (MemoryStream)data.GetData ("Visio 11.0 Shapes");

Thanks
Anne

"Chris Roth [ Visio MVP ]" <[email protected]> a écrit dans
le message de news:[email protected]...
I'm not 100% sure about this, after reading a paragraph in Wideman's book,
but I think you need to somehow query the clipboard to find out the ID of
"Visio 11.0 Shapes", then use that ID in the GetData function. The ID may
change from windows session to session.

--

Hope this helps,

Chris Roth
Visio MVP
 
A

Anne Nonyme

doig that : ido.GetData( "Visio 11.0 Shapes" )

You get a MemoryStream that represents a OLE2 Compoud file that contains the
shape.

Thanks for help.
Regards
Anne



Chris Roth said:
How about something like this:

IDataObject ido = Clipboard.GetDataObject();

Visio.ActivePage.Drop( ido.GetData( "Visio 11.0 Shapes" ), 0, 0 );


--

Hope this helps,


Chris Roth
Visio MVP


Anne Nonyme said:
Thanks for answer, but I don't understant it...

The problem is : how to re-create a Shape from the MemoryStream ?

IDataObject data = Clipboard.GetDataObject();
MemoryStream l_MemStream = (MemoryStream)data.GetData ("Visio 11.0 Shapes");

Thanks
Anne

"Chris Roth [ Visio MVP ]" <[email protected]> a écrit dans
le message de news:[email protected]...
I'm not 100% sure about this, after reading a paragraph in Wideman's book,
but I think you need to somehow query the clipboard to find out the ID of
"Visio 11.0 Shapes", then use that ID in the GetData function. The ID may
change from windows session to session.

--

Hope this helps,

Chris Roth
Visio MVP


Hello,
I wand to get out a Visio Shape from the clipboard (c#).

IDataObject data = Clipboard.GetDataObject();
System.IO.MemoryStream l_MemStream = (System.IO.MemoryStream)data.GetData
("Visio 11.0 Shapes");

How to re-create a Shape from this MemoryStream ?

I try to do :

data.GetData (typeof(Microsoft.Office.Interop.Visio.ShapeClass))

but returns null.

Thanks
Anne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top