DragDrop

  • Thread starter Thread starter Meelis
  • Start date Start date
M

Meelis

Hi

Is it possible and when, then how?

I wanna drag/move picturebox on a winform and drop in another place?
Problem is i wanna see picturebox contents while dragging.


Regards;


Meelis
 
Meelis,

Search www.codeproject.com for drag and drop examples.

If your dragging to "another place" refers to another application, see:
Performing Drag-and-Drop Operations Between Applications
http://msdn.microsoft.com/library/d...btskPerformingDragDropBetweenApplications.asp

As for seeing the picture as it is moved, try creating a custom cursor,
which is actually made from the image itself.

I know I've seen this done somewhere so I did a google search....and got
this hit:

Wiktor Zychla posted this on May 27 2003, 4:52 am:

modify the code snippet below to set the mouse pointer to proper image in
Drag&Drop. it works for me. images are even build dynamically and show the
content of the item beeing dragged.

Bitmap b = new Bitmap( 30, 15 );
Graphics g = Graphics.FromImage ( b );
g.DrawString ( "text", this.Font, Brushes.Black, 0, 0 );

IntPtr ptr = b.GetHicon();

Icon i = Icon.FromHandle ( ptr );
Cursor c = new Cursor( ptr );

this.Cursor = c;



Dave
 
hi

yes this works, but...

I need also trace pictures upper left cornern cordinates while moveing.

Picture is 50x50pix and on dragging when upperleft corner is "in speccial"
posissin and user drops picture i need set this cordinates


Meelis
 
Meelis,
I need also trace pictures upper left cornern cordinates while moveing.

There are some methods fired during the drag operations, but none of them
surface the mouse's coordinates...
I'm referring to GiveFeedBack and QueryContinueDrag, which are sent back to
the control that STARTED the drag operation with a call to DoDragDrop.
Picture is 50x50pix and on dragging when upperleft corner is "in speccial"
posissin and user drops picture i need set this cordinates

You can get the coordinates (X,Y) in the Drag Drop event of the control that
the user drops the picture on.

Dave
 

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

Back
Top