Custom Cursors when dragging and dropping

D

Dan

I am dragging and droppng from a picture box component to a listbox control.

I am calling the DoDragDrop method from the Picture boxes Mouse down event
handler.

private void pictureBox1_MouseDown(object sender,
System.Windows.Forms.MouseEventArgs e)
if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
{
pictureBox1.DoDragDrop(myData, DragDropEffects.All);
}

I want to display a custom cursor called colCursor when the mouse is over
the drop target, and another (called monoCursor) when its not. I
implemented the following event handler.

private void pictureBox1_GiveFeedback(object sender,
System.Windows.Forms.GiveFeedbackEventArgs e)
{
e.UseDefaultCursors = false;
if (e.Effect==DragDropEffects.None)
{
Cursor.Current = monoCursor;
}
else
{
Cursor.Current = colCursor;
}
}

Now the problem is this, when i start dragging from the pictureBox
component, the cursor defaults to the standard "Not valid drop target"
cursor) even though the Cursor.Current = monoCursor; line in the above code
is being called. Its not until the mouse moves over to the listbox when the
cursor changes to the colCursor one. However, if I then move the mouse
*back* to an invalid area on the form - the cursor *does* change to the
monoCursor one.

Does anyone have any ideas whats going on?!? Any help would be great!

Thanks

Dan
 
I

ilPostino

My experience with cursors and microsoft's .net is that is doesn't work, you
can change cursors in some places but not all places
so its normally best not to bother. I'm even changing mine using the
win32api and I still can't stop ms from changing it back :(


iP
 

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