Solved

my Usercontrol Backcolor & the mouse

Posted on 2002-03-30
5
392 Views
Last Modified: 2008-02-26
Hi Sirs,

in my own usercontrol, i want it to change its colour whenever the mouse just comes over it then i typed this code and it is OK

Private Sub UserControl_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Shape1.BackColor = &H404080
Shape2.BackColor = &H80000001
End Sub

the problem is when i put the mouse away of the usercontrol it stay by the new Backcolor (as shown in the code above) but i want its Backcolor to return into the original color whenever i put the mouse away of it.

note: my usercontrol consists of 2 shapes as shown above  

Please i need your help to amend this code to let me do that.

Many Thanks in advance
Toni2002
0
Comment
Question by:toni2002
5 Comments
 
LVL 1

Accepted Solution

by:
COAtheGREAT earned 50 total points
ID: 6907774
You should use mouse_move of the form that holds control and made public sub to set colors to original, so form call that sub when resive mouse_move.
0
 
LVL 1

Expert Comment

by:alaplume
ID: 6907846
Or better yet, Mouse_Over.
0
 
LVL 16

Expert Comment

by:Richie_Simonetti
ID: 6908320
Where do you found Mouse_over event?
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 6910469
The problem with VB is that it doesn't support a mouse_out event.  This means that the only way to tell (through VB) when a mouse has left your control is to guess.

One way to "guess" is to set a timer in the mousemove event procedure.  If the timer goes off, either the mouse is elsewhere or the person stopped moving the mouse.

The only other way to handle this is to have another part of the VB project recognize that the mouse has moved over IT, and have IT report back to your usercontrol that the mouse has moved away from the control.

Other than that, I think there's a Windows API to detect mouse movement, with which you can get the coordinates.  If the coordinates are not over your control, reset the color.
0
 

Author Comment

by:toni2002
ID: 6910810
changing Backcolor of the usercontrol using this answer is failed, BUT I USED CHANGING "FONTBOLD" INSTEAD THEN IT SUCCEED !!!!!!!
I don't know why .......!!!
May someone knows..
Anyway have something is better than nothing.

Toni2002
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now