[RESOLVED] Trying to get custom mouse cursor to load when the mouse is over a picture box?
Hello everyone! I am working on a simple tool to help draw the computer, so when I teach students I can use these touch screen computers they have now. So the students can see my mouse cursor easier, I would like to use a custom one that looks like a big pencil.
I can get the pencil to show up when I am on the form itself, but when I go over the picturebox to draw, it just gives me the default windows one.
I am using mouse down, and mouse move to "Draw", and this code to try to load the mouse cursor for the mouse move event, but still no change.
Re: Trying to get custom mouse cursor to load when the mouse is over a picture box?
Good idea. I can perhaps make the cursor into a gif file, and assign it. The only thing is, I cannot open the cur file with my paint programs or paint.net, do you know of a prog that will open this cursor? THANKS!
Re: Trying to get custom mouse cursor to load when the mouse is over a picture box?
My posted wasn't intended as an 'idea'. I was describing how you are supposed to use the MousePointer property. Perhaps you can use your current graphic (Pencil.cur) in the way you did previously;
i.e.
Picture1.MousePinter = 99
Picture1.MouseICON = LoadCursorFromFileW(StrPtr(App.Path & "\Pencil.cur"))
If you don't know where you're going, any road will take you there...
Re: Trying to get custom mouse cursor to load when the mouse is over a picture box?
Thank you! I am getting a type mismatch error on the line Picture1.MouseIcon = LoadCursorFromFileW(StrPtr(App.Path & "\Pencil.cur")), is there is anything I need to add before it?
Re: Trying to get custom mouse cursor to load when the mouse is over a picture box?
If you only have one PictureBox in your Form, then see this post in your previous thread, else you'll have to convert your pencil.cur, which is actually an .ANI cursor file, to the real .CUR format or .ICO format because VB can't load .ANI cursors. IrfanView can convert your .ANI cursor to .ICO which VB's PictureBox can then use as the MouseIcon by loading through LoadPicture() or setting via the Properties Window.
Last edited by Bonnie West; Mar 17th, 2013 at 02:09 AM.
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
Re: Trying to get custom mouse cursor to load when the mouse is over a picture box?
That works great. I got the ico file, and it loads up just fine. The only issue is what was the transparent background is now black. I opened the file up, took out the black background, then saved it, but then vb says invalid file type, so then I go back into infraview, save it, then it is saved as a black background again lol. Is there a way to remove the background? Thanks!
Re: Trying to get custom mouse cursor to load when the mouse is over a picture box?
Before saving that .ANI cursor as an .ICO file, IrfanView will allow you to select the transparent color. Did you dismiss that dialog?
On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0