tags:

views:

112

answers:

3

Hi, Can anyone tell me how can I display an image next to the cursor like Vista (When dragging a file to folder it shows a "Copy to..." tooltip)?

A: 

The short answer starts with:

Cursor myCursor = new Cursor("myCursor.cur");

The details are explained in this article: How To Use Custom Cursors

Doug L.
The problem with this is that the center of my image will be point the screen instead of the Arrow head.
Mohammadreza
A: 

Look at the following article:

http://blogs.msdn.com/adamroot/archive/2008/02/15/shell-style-drag-and-drop-in-net-part-3.aspx

Update: You need to apply the following modifications in SwfDragSourceHelper.cs to enable WinXP support.

public static void AllowDropDescription(bool allow)
{
    IDragSourceHelper2 sourceHelper = new DragDropHelper() as IDragSourceHelper2;
    if (sourceHelper != null)
        sourceHelper.SetFlags(allow ? 1 : 0);
}
arbiter
Thanks for your link. Its exactly what I wanted. But one more question can I use APIs used in this article in Windows XP?
Mohammadreza
Yes, with some small modifications. In general you need to disable IDragSourceHelper2 support, and use IDragSourceHelper instead. Of course all logic related to drag descriptions are also not needed in XP. I have updated my answer.
arbiter