[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Slowly change colors of a label

Posted on 2002-05-07
2
Medium Priority
?
187 Views
Last Modified: 2010-05-02
Hi, how would I possibly take a label with the text color being white and slowly fade it to be red text when the user moves the mouse over it?  If at all possible, I would like to do it without using a timer.  Thanks.
0
Comment
Question by:jonnyfunfun
[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
2 Comments
 
LVL 22

Accepted Solution

by:
rspahitz earned 200 total points
ID: 6995337
Without a timer it becomes much more difficult, and ultimately it needs a timing mechanism to control the rate of progress.

I'd recommend this:

Add a timer, Timer1, with interval=100 and enabled=false, then add this code:

Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
  If Not Timer1.Enabled Then
    Label1.BackColor = vbWhite
    Timer1.Enabled = True
  End If
End Sub

Private Sub Timer1_Timer()
  Dim lCurrentColor As Long
  lCurrentColor = Label1.BackColor
  lCurrentColor = lCurrentColor - CLng(8 * CLng(256 ^ 2)) - CLng(8 * 256)
  If lCurrentColor <= 0 Then
    Timer1.Enabled = False
    Label1.BackColor = vbRed
  Else
    Label1.BackColor = lCurrentColor
  End If
End Sub
0
 
LVL 22

Expert Comment

by:cookre
ID: 6995455
How about changing the lable to a graphic that you replace with an animated GIF when you detect mouse over?
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

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…
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…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

656 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