[RESOLVED] CommandButton Text: Zoom In/Zoom Out on Mouse Events
I have a CommandButton and I've tried the obvious ways to make the Font Zoom Up to a certain level on the MouseOver Event and Zoom Out when the mouse is not on the CommandButton but none have worked.
There is probably something really simple I'm not doing so can someone please help me out?
Thanks Heaps (I love this Forum xD)
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Maybe something like this?
Code:
Option Explicit
Private Declare Function GetCapture Lib "user32" () As Long
Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
With Command1
If GetCapture() = .hwnd Then
If ((X < 0) Or (X > .Width)) Or ((Y < 0) Or (Y > .Height)) Then
Call ReleaseCapture
.FontSize = 8
End If
Else
Call SetCapture(.hwnd)
.FontSize = 10
End If
End With
End Sub
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Doesn't wont to work, there are no error but the code does not change anything.
Just to rephrase my question: When I have the MouseOver the CommandButton the font will gradually get bigger eg 8 -> 10 -> 12 -> 14. When the mouse finally leaves the CommandButton the font will the cycle back down like 14 -> 12 -> 10 ->8
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Quote:
Originally Posted by MongooseRoadkill
Doesn't wont to work, there are no error but the code does not change anything.
Just to rephrase my question: When I have the MouseOver the CommandButton the font will gradually get bigger eg 8 -> 10 -> 12 -> 14. When the mouse finally leaves the CommandButton the font will the cycle back down like 14 -> 12 -> 10 ->8
Odd that code has always worked for me.
Do you have button on the form named "Command1"?
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Yea it's called Command1 but for some reason it won't work?
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Sorry to bump, but does anyone have an answer?
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Edgemeal's code works just fine. When you say it doesn't is it because it doesn't gradually increase the font size but rather just switch between 8pt and 10pt? Maybe it's just because the font that your using doesn't come in 8 and 10pt size? Which font are you using?
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
Try using Edgemeal's code again, but set the text Bold then back.
Might be more noticeable
Re: CommandButton Text: Zoom In/Zoom Out on Mouse Events
I've found out the problem now, It was becuase I had the Manifest file that converts VB6 IDE to the current theme of your XP but I just removed it and now the code works fine and I got it to cycle up and down aswell :) In the end the code I wrote it the first place was correct but the Manifest file was bugging it out...
Plus Reps for those who helped (All of you)