|
-
Mar 7th, 2001, 12:05 PM
#1
Thread Starter
Evil Genius
I have a group of command buttons (lets say cmd(1 to 5))
My question - I want the backcolor to change when the mouse goes over it - no problem, I use the mousemove / mouseover event whatever it is.
BUT - I need the backcolor to reset after the mouse has finished passing over it, a sort of mouseover_finish event.
I could write 10,000 lines to check the axis / co-ordinataes of the mouse, but do I have any easier options please?
-
Mar 7th, 2001, 12:07 PM
#2
Lively Member
Hi,
On the mouse_move of the container of your cmdBouttons, reset the color back to its original. I don't know the layout of your program though...
Steph
Virtually Impossible !
VB5 Entreprise (SP3) - VB6 Entreprise (SP4), MSSQL7, MSAccess, VBA, VBScript, ASP
-
Mar 7th, 2001, 12:14 PM
#3
Fanatic Member
Try setting the color back on other mouse over events:
so:
Code:
Private Sub Command1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
recolorall
Command1.BackColor = vbRed
End Sub
sub recolorall()
Command1.BackColor = &H8000000F
etc
end sub
note: you will have to change the graphical property to true
place recolorall command in all of the controls and the forms mousemove event.
Rob
-
Mar 7th, 2001, 02:10 PM
#4
Its a shame that MS didn't invent a Mouse_Out event for all of the common controls, its quite a glaring omission in my opinion!
Anyway, you could set up a timer to call...
Code:
Declare Function GetCursorPos Lib "user32" Alias "GetCursorPos" (lpPoint As POINTAPI) As Long
...every 10th of a second or so, and if the coords are outside any of the buttons then you can change the colours accordingly. API functions such as the one above execute very quickly and should not make a dent on the performance of your application.
Furthermore, it should take considerably less than 10,000 lines of code!
-
Mar 7th, 2001, 05:54 PM
#5
Fanatic Member
I agree with Steph, just put code in the mouseover event of the container i.e. the form that the controls have been placed on. Easy. So when the mouse moves over a control, it changes colour or whatever, then when it moves over the form (but not over a control) it does whatever you have coded in the form's mousemove event.
-
Mar 7th, 2001, 06:45 PM
#6
Addicted Member
I agree with JamesM and Steph, that appears to be the simplest solution.
Stephen Boston
Onward!
 VB6 Pro SP4, VBScript
A+ Certified Techncian.
No matter where you go, there you are.
-
Mar 7th, 2001, 06:49 PM
#7
_______
<?>
Of course if your buttons are touching in a line then the container idea won't work under all circumstances so you would want your opposite in the container or any other control you might move over to get to the container.
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|