Custom Cursors in Windows

I have several custom cursors in my game depending on where you hover. They look great in Mac but they don’t work at all in Windows. I the cursors are sliced and cut off with staticy pieces in the wrong places. Is there a special format I’m supposed to use for Windows cursors?

I recall the info in these threads saving the day for me:

The cursor images I am using are PNG. I have the PNG’s stored in string form in a data file and I have a function that gets the string, converts it to a PNG Image and loads it into the cursor’s Constructor method.

curNormal = New MouseCursor curNormal.Constructor(GetPicture("PNG", "Cursors", "PicRegular", 13), 10, 16)

Is there something wrong with that in Windows?

GetPicture is a Function that grabs the image strings I have in a database file, where “PNG” is the type of image, “Cursors” is the Table and “PicRegular” is a Field and 13 is the ID number for that particular image in the “Cursors” Table.

It seems like everything with macOS is easy and with Windows you have to jump through thousands of hoops to get the same result as you can easily on Mac.

I suggest you read the threads I quoted.

I did but I don’t see a difference and the 2nd one is so old it may not even work like that anymore.

Works for me. (Im in one of the posts at least)

The documentation of custom cursors still says that pretty colors aren’t possible in Windows:

[quote]On Windows, you can create cursors with a Windows resource editor and then import the .cur files that it creates into your project. Currently, only 16 x 16 monochrome cursors are supported.

If you dont fancy the cursor editor thing to make a CUR file, you can use my cursor editting code to get an XML file.

XML cursors work on both
PNG only on Macs - maybe things have changed with Direct2D but since youre asking, I’ll assume not

Your Dropbox link is dead.

I dont have a drop box account. Whose box is it?

Go to the source I posted here:

You’d be better off using the NEW cursor method instead of the XML one unless you want tiny cursors

[quote=378729:@Jeff Tullin]Go to the source I posted here:[/quote]

I put the original file I got from you at:

I hope you have no objection - I’ll remove it if you do.

FYI… Jeff based that code on work I did years ago [which he did credit further down in the link he posted]

How exactly do I use this? It doesn’t let me import my PNG files so I’m lost.

Why is everything with Windows so difficult?

My cursors are 64x64.

be more specific.

you simply “drag” you PNG file into the project

no comment :slight_smile:

Then what? How do I tell the code to convert the png to xml?

you don’t
you read the language ref

for Carbon the only method was the XML way… for Cocoa the PNG method allows better looking cursors (of any size you want)
I don’t know when the PNG method was first available for Windows

All that doesn’t work on Windows. The problem is all of my custom PNG cursors look like crap on Windows. They look great on Mac. I guess you didn’t read my initial question?

Really! I can’t use the c word for poo?

I don’t think this app does what you think it does, Charles.

You draw your cursor in four colors with this, it doesn’t have anything to do with your existing pngs. I don’t see a read method like that.

Edit: I lied, two colors, and you can pick a hotspot.

Unless you want to write some code to convert the PNG to BITMAP then convert your BITMAP to a CURSOR I’d suggest just converting your PNG files to ICO using an online converter (google) and including ICO files with your windows program and PNG with your Mac edition.

Interesting, this worked first time, no corruption, I had my cursor as a huge screenshot that I took.

In Window.Open:

[code]Dim f As New folderitem(“C:\Users\Julian\Desktop\Capture.png”)
Dim p As picture
p =

Dim m As New MouseCursor(p, 0, 0)
Me.MouseCursor = m[/code]

What OS & version of Xojo are you using?

Could you upload/link the png you’re trying to set as a cursor so I can see if it works here?