Results 1 to 3 of 3
  1. #1
    Join Date
    Jan 2004
    Posts
    9

    Unanswered: form flicker on mouse move event

    I have a form with some labels, that change color on a mouse move event.
    a mouse move on the forms detail chanegs the color of the labels back to its origional color.

    the problem is : it flickers a lot, even if I move the mouse even a milimeter while staying on one label, its like the form is refreshing every second.

    Used access 2000 to develop the form, it was fine; opened it up in access 2002 and it flickers

    how can I fix this?

  2. #2
    Join Date
    Nov 2003
    Posts
    1,487
    Let say the Label's fore color starts out as Blue and when the mouse passes over it, the label fore color changes to red, then, when the mouse continues along and hits into the details section it returns the label fore color back to blue.

    In your forms (detail) MouseMove event set it up so that a condition must be met before a change is attempted, otherwise the change is attempted all the time. For example:

    Code:
    Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
       'This will always give flicker.
       myLabel1.ForeColor = vbBlue
       myLabel2.ForeColor = vbBlue
       myLabel3.ForeColor = vbBlue
       myLabel4.ForeColor = vbBlue
    End Sub
    Code:
    Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
       'This will not give flicker.
       If myLabel1.ForeColor =vbRed Then myLabel1.ForeColor = vbBlue
       If myLabel2.ForeColor =vbRed Then myLabel2.ForeColor = vbBlue
       If myLabel3.ForeColor =vbRed Then myLabel3.ForeColor = vbBlue
       If myLabel4.ForeColor =vbRed Then myLabel4.ForeColor = vbBlue
    End Sub
    ************** OR **************

    Code:
    Private Sub Detail_MouseMove(Button As Integer, Shift As Integer, _
    X As Single, Y As Single)
       'A nicer way....This will not give flicker.
       Dim Ctrl As Control
       For Each Ctrl In Me.Controls
            If Ctrl.ControlType = acLabel AND Ctrl.ForeColor = vbRed Then 
               Ctrl.ForeColor = vbBlue 
            End If
       Next Ctrl
    End Sub
    Just for the heck of it.....for added effect. Change the font name for your labels to Arial and the TextAlign to Center. Make the font size...oh...9
    Now in the Label's OnMouseDown event place the following code (assuming the label's name is Label1):

    Me.Label1.FontSize = 8

    In the Label's OnMouseUp event place this code line (again assuming the Label's name is label1):

    Me.Label1.FontSize = 9

    This will give a button press effect.

    Hope this helps.
    FF

  3. #3
    Join Date
    Jan 2004
    Posts
    9

    Wink

    Thanks!!! I 'll try it out

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •