Pnt = Nothing If tmp.hbmMask IntPtr.Zero Then DeleteObject(tmp.hbmMask) ' Clean Up If pnt IntPtr.Zero Then DestroyIcon(pnt) _gCursorImage = Icon.FromHandle(curPtr).ToBitmap ' I use it to create a screen shot with the gCursor included ' Save the image of the cursor with the _gBlackBitBack effect ' Not really needed for normal use. Tmp.hbmColor = bmp.GetHbitmap(Color.FromArgb( 0, 0, 0, 0))Įnd If ' Create the Pointer for the Cursor Icon Dim pnt As IntPtr = Marshal.AllocHGlobal(Marshal.SizeOf(tmp))
Tmp.hbmMask = bmp.GetHbitmap(Color.FromArgb( 0, 0, 0, 0)) Private Shared Function CreateIconIndirect( _īyVal iconInfo As IntPtr) As IntPtr End FunctionīyVal handle As IntPtr) As Boolean End FunctionīyVal hObject As IntPtr) As Boolean End Function Private curPtr As IntPtr Public Function CreateCursor( ByVal bmp As Bitmap) As CursorĮnd If ' Setup the Cursors IconInfo Dim tmp As New IconInfo
Public fIcon As Boolean Public xHotspot As Int32 Public yHotspot As Int32 Public hbmMask As IntPtr Public hbmColor As IntPtr End Structure Part One - gCursorįor a Quick and Dirty, you can simply take any Bitmap and use it in the Cursor’s new method. Both of these Cursors let you build 3 main types of custom cursors: Text, Picture, or Picture and Text combination. Each has its Pros and Cons over the other, but usually one of them will fit the bill. Then in the process of making the gCursor I got another idea to use ToolStripDropDown which also ended up working pretty well. Despite this irritating hitch, I still saw the answer to my cursor needs. So if anyone knows a cure for the bitmap “Blues” please enlighten us all. I did figure out the blue tint can be switched to a black tint, and that putting an alphablended bitmap on the clipboard suffers the same fate. So far I have not come up with a workable solution. I spent way too much time searching, thinking there must be an answer out there… somewhere… anywhere. I soon became obsessed with trying to solve the blue tint problem with converting an alphablended bitmap to a cursor. Then I saw the xCursor article by Elkay and saw new hope. Of course, this had flicker and boundary clipping problems that I never liked. I had continued to rely on the old workarounds like painting an image on the control or by having a Label, PictureBox, or combination follow the cursor around the screen. I had hoped it would have been updated in. I have always disliked the standard Inviso-Drag and Drop cursor.