Drag and Drop onto a Visio Canvas

C

Cappy

Hi,

I'm working in a C# environment and created an interface containing a
listview and a visio canvas.
I'd like to drag and drop an item from the listview onto the visio
canvas. To do so I have implemented the ItemDrag and the DragOver
functions of the listview and I have set the AllowDrop property of the
visio control to true

Now, my question is which functions I should implement in the visio
control in order to accept the drop event? On this moment the cursor
changes into a forbidden sign if I hover over the visio control. When
dragging and dropping onto another type of control, they contain
functions such as DragDrop in which these events can be handled, the
visio control however does not seem to contain these functions

Can anyone help me with this problem?

Greetings

Cappy

PS: I already tried some of the suggestions in other treads but none of
them seem to work for me
 
C

Cappy

Yeah, I tried using that function but it doesn't seem to work, but
maybe I forgot to set some other properties
On this moment, the pointer becomes a forbidden sign if I hover the
canvas and when I release the mouse button, no event is fired ... at
least not the shape added event

Are there any settings that I may be forgotten? The allowDrop property
is set to true

Greetings

Cappy
 
C

Chris Roth [MVP]

Visio understands IDataObject, which you can supply in the DoDragDrop
method.

What are you trying to drop? If your listview item corresponds to a Visio
master, then you can just supply that, and you don't have to tell Visio to
do anything.

--
Hope this helps,

Chris Roth
Visio MVP

More Visio shapes, articles, development info and pure diagramming fun at:
www.wanderkind.com/visio
 
C

Cappy

We just have a list of strings containing properties (so no Visio
master). Depending on which string is drag and dropped, some shape
properties should change.

Greetings

Cappy
 
M

Markus Breugst

Hi,

anything new concerning this issue? Currently I have the same problem.

Chris: I am trying to drop pure text. As you suggested, I am using
IDataObject, but the Visio control does not allow me to drop it. There's
just the "forbidden" cursor, surrounded by a dotted frame. Seems as if the
Visio control expects a Master to be dropped.

If I put a Master object into the IDadaobject, it works. However, I have to
drop pure text. When using the Visio Application, it works in the way that
Visio creates a text shape. (That's what I want.) But when I use the ActiveX
control, it does not work.

Funny thing: If I drag text from TextPad into the ActiveX control, it works:
The control creates the expected text shape.

Seems that the control does not recognize the dragged data inside the
IDataObject instance as being text.

Any ideas?

Best regards,
Markus

PS: I found a newsgroup thread from 2003 describing exactly the same problem
(issues by "Steve Cox"). Unfortunately it remained unsolved.
 
M

Markus Breugst

Got it!
(seems that I'm currently a bit too fast with telling you my questions)

You have to use OemText as data format:

Example:
IDataObject data = new DataObject(DataFormats.OemText, draggesText)
DoDragDrop(data, DragDropEffects.All);

(Before, I tried it with DataFormats.StringFormat and DataFormats.Text, and
it did NOT work.)

Best regards,
Markus
 

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