?
Solved

my Usercontrol Backcolor & the mouse

Posted on 2002-03-30
5
Medium Priority
?
401 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 1

Accepted Solution

by:
COAtheGREAT earned 150 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses
Course of the Month12 days, 15 hours left to enroll

777 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