[RESOLVED] Drag drop "overlay picture"
In windows when you drag from explorer there is a custom "picture" when the items are dragged ... how can i do this in vb.net?
I know how to do drag drop but not with the picture...
also note: I DO NOT just want to change the cursor icon ... in explorer the drag picture can be bigger than 32x32 and i need it to be in my project also
Thanks in advance
Kris
Re: Drag drop "overlay picture"
Re: Drag drop "overlay picture"
what are you D+D'ing?
cursors aren't limited to 32*32. they can be any shape or size.
Re: Drag drop "overlay picture"
does anyone know of an example that is in VB not C# and C++?
Thanks
Kris
Re: Drag drop "overlay picture"
and just checked u can change the cursor bigger than 32x32 - so i guess changing the cursor would be fine 2...
Re: Drag drop "overlay picture"
Quote:
Originally Posted by
i00
and just checked u can change the cursor bigger than 32x32 - so i guess changing the cursor would be fine 2...
as I told you in post #3.
anyway, you create a bitmap for your cursor + then create a cursor from your bitmap:
vb Code:
#Region " CreateIconIndirect"
Private Structure IconInfo
Public fIcon As Boolean
Public xHotspot As Int32
Public yHotspot As Int32
Public hbmMask As IntPtr
Public hbmColor As IntPtr
End Structure
<DllImport("user32.dll", EntryPoint:="CreateIconIndirect")> _
Private Shared Function CreateIconIndirect(ByVal iconInfo As IntPtr) As IntPtr
End Function
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Public Shared Function DestroyIcon(ByVal handle As IntPtr) As Boolean
End Function
<DllImport("gdi32.dll")> _
Public Shared Function DeleteObject(ByVal hObject As IntPtr) As Boolean
End Function
''' <summary>
''' CreateCursor
''' </summary>
''' <param name="bmp"></param>
''' <returns>custom Cursor</returns>
''' <remarks>creates a custom cursor from a bitmap</remarks>
Public Shared Function CreateCursor(ByVal bmp As Bitmap) As Cursor
'Setup the Cursors IconInfo
Dim tmp As New IconInfo
tmp.xHotspot = 0
tmp.yHotspot = 0
tmp.fIcon = False
tmp.hbmMask = bmp.GetHbitmap()
tmp.hbmColor = bmp.GetHbitmap()
'Create the Pointer for the Cursor Icon
Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tmp))
Marshal.StructureToPtr(tmp, pnt, True)
Dim curPtr As IntPtr = CreateIconIndirect(pnt)
'Clean Up
DestroyIcon(pnt)
DeleteObject(tmp.hbmMask)
DeleteObject(tmp.hbmColor)
Return New Cursor(curPtr)
End Function
#End Region
Re: Drag drop "overlay picture"
sorry i actually resolved this before your post
Thanks anyway
Kris