Results 1 to 17 of 17

Thread: I am getting weaker, weeeaker, weeaakke...r

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    I have typed and typed, till the tissue of my finger tips have been exposed. I have moaned, groaned, and on several occassions I had come close to posting a significant amount of money as a reward for my answer. Neither My annoying reposts or persistance seem to yeild a termination to my insanity. Luckily with clever use of Cut n Paste, I have been able to overlook the tediousness of the posting/reposting questions.

    By now I am sure you are waving your hands about frantically demanding me to get to the point, well the point is, actually just another same old, same old question...
    "How do I code a seemless Java Like RollOver effect, that will not suffer from the disturbingly annoying *flicker or flash*?

    I Use VB5 Enterprise Ed. I have 5 images set to "VISIBLE=TRUE" and 5 smaller images that are set to "VISIBLE=FALSE". I use the API and a timer(interval of 1), to track when the user's mouse is placed over the top of a certain image, (obviously a crude explanation of the real coding). This triggers the code to set an appropriate hidden IMAGE to be set to "VISIBLE=TRUE" and the previous image to be set for "VISIBLE=FALSE". This, in theory is supposed to create the Javalike rollover illusion that many of us ar so familiar with. The problem is that the actaul act of hiding/unhiding causes an unnatural anomaly. The images seems to *flicker* quickly before the RollOver effect is complete. I am asking, rather begging for the right person who is skillful and fluent enough with VB5 and RollOver effects, to cure my "Image Flickering" disease.

    P.S. Sorry for the repost, but I know that sooner or later the right person will see my post and put an end to my suffering, by injecting me with the appropriate answer.

    I appreciate all of your time and efforts spent on the quest at hand, thank you,
    Daniel Christie

    Please feel free to email me the answer, all though I am sure many of my peers here would love to see the resolve posted on the board..

    [Edited by Daniel_Christie on 04-19-2000 at 02:58 AM]

  2. #2

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Cool Wow, I see the VIEW total but where is all the Replies :-)

    I see all the VIEWS for this post but yet there is a lack of Replies. I bet you all are hard at work right now in intense search for the cure.

  3. #3
    Addicted Member
    Join Date
    Nov 1999
    Posts
    184

    Wink I have the answer :)

    Ok,

    Heres one of two solutions to your horrable
    question..

    1.If your using a series of picturebox's ,
    they WILL flicker no matter what because
    they are more then 5k apiece... They take
    some time to refresh.
    On the other hand a Image is a lot less
    advanced but it shouldnt flicker because
    the coding for it is alot less space.

    Hopefully that was the right answer..

    2.The other solution is ActiveX. You can
    use a feature of it ( I dont remember
    exactly how but I can figure it out
    if you must.. )

    I hope that helps somewhat..

    Evan Duffield --------
    --- [email protected]
    - -
    VB6 - Learning Edition
    - -


  4. #4

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    Dayo312,

    I thank you for your reply. I will persue the ActiveX. I ofcourse will start out by knowing very little about the subject, yet in time a solid knowledge will ensue.
    Dayo312 if you happen to know the solution or it is easily attainable, please by all means enlighten me. :-)


    P.S. My images are easily 12k apiece (the size could not be avoided). I have tried both the Image boxes and the Picture boxes. Both produce the same anomaly.

    Thanks again,
    Daniel Christie

  5. #5
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554
    Hi daniel,

    I was once interested in the coolbar demo at the microsoft site and therefore downloaded it. upon looking at there code i discovered that the switch/rollover was created by detecting when the mouse was over the image, and when it wasn't over it, switch the picture back.

    I couldn't help but notice that if i flew the mouse over the image very fast (or reasonably fast - no faster than in normal use - but definately not slow) then it did not detect the movement, the reason for this was that the area directly containing the image was not large enough to detect it when the mouse was moving fast. and having tried a quick sample with activeX controls, have come round to the same conclusion. Another point is that, as these directly containing controls were not large, subsequently the routine to turn the highlight effect off was called whenever the mouse was NOT over the image but was over other controls, ie like the form for example or the toolbar background image too.

    Anyway I've emailed you the sample i created, it didnt take long and contains two images, each one is 17Kb and they did not flicker, except when i flew the mouse over the right hand image as the control kinda, was in ready state then rollover state then ready state again (kinda OFF-ON-OFF)

    DocZaf
    {;->

  6. #6

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Thanks Zaf Khan

    Much appreciated Zaf Khan

    I am checking my email right now! :-)

  7. #7

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Steve's Got Mail!

    Thanks _eclipsed_,

    I sent Steve an Email. hope he can help. :-)

  8. #8
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    This is in VB6 Pro Ed. It'll probably work on yours

    You'll have to account for the SrcInvert when you make your own pictures.

    Put three pictures on a form (I don't give a toss about naming conventions). This is my way of telling you how to set the properties more quickly than explaining them to you individually:

    Code:
    'Picture1 is the Display Picture
    With Picture1
        .Picture = (None)
    End With
    'Picture2 is the MouseNotOver Picture
    With Picture2
        .ScaleMode = 3
        .AutoRedraw = True
        .Visible = False
        .Picture = (Your MouseNotOver Picture)
        .BorderStyle = 0
        .Appearance = 0
    End With
    'Picture3 is the MouseOver Picture
    With Picture3
        .ScaleMode = 3
        .AutoRedraw = True
        .Visible = False
        .Picture = (Your MouseOver Picture)
        .BorderStyle = 0
        .Appearance = 0
    End With
    And now for the real code:
    Code:
    'In Module:
    Public PicNorm As Boolean
    
    'In General Declarations:
    
    Private Declare Function BitBlt Lib "gdi32" (ByVal hDestDC As Long, ByVal X As Long, ByVal Y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal dwRop As Long) As Long
    
    'In Form Code:
    
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Static OpBef
    If OpBef = False Then
        BitBlt Picture1.hDC, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture2.hDC, 0, 0, vbSrcInvert
        OpBef = True
        Exit Sub
    End If
    If PicNorm = False Then
        BitBlt Picture1.hDC, 0, 0, Picture3.ScaleWidth, Picture3.ScaleHeight, Picture3.hDC, 0, 0, vbSrcInvert
        BitBlt Picture1.hDC, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture2.hDC, 0, 0, vbSrcInvert
        PicNorm = True
    End If
    End Sub
    
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If PicNorm = True Then
        BitBlt Picture1.hDC, 0, 0, Picture2.ScaleWidth, Picture2.ScaleHeight, Picture2.hDC, 0, 0, vbSrcInvert
        BitBlt Picture1.hDC, 0, 0, Picture3.ScaleWidth, Picture3.ScaleHeight, Picture3.hDC, 0, 0, vbSrcInvert
        PicNorm = False
    End If
    End Sub
    I don't know if this is what you wanted, but it sure doesn't flicker! (On my computer, anyway)

    See ya!

    Code:
    Unload Me
    Courgettes.

  9. #9

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    Dayo312,

    I tried to email ya, but Hotmail replied me back saying that your Juno email address is not a valid user. ????

    I am eagerly awaiting your ActiveX solution for my problem with the Java like RollOver code. :-)

  10. #10

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Talking

    V(ery) Basic, thanks for your source.

    I will try it out as soon as I am home infront of my PC.

    Thanks again,
    Daniel Christie

  11. #11
    Junior Member
    Join Date
    Feb 2000
    Posts
    25

    Daniel Christie

    Daniel I got the same message about that email address. Bet that sucks huh?

  12. #12
    Junior Member
    Join Date
    Feb 2000
    Posts
    25

    I am not sure if this will help you out or not...

    Hope you can get something from this to help you out.

    Option Explicit

    Dim highlighted As Boolean

    Private Type POINTAPI
    x As Long
    y As Long
    End Type
    Private Declare Function ScreenToClient Lib "user32" (ByVal hwnd As Long, lpPoint As POINTAPI) As Long
    Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long

    ' Highlight the control.
    Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
    If highlighted Then Exit Sub
    highlighted = True
    Label1.ForeColor = vbRed
    Timer1.Enabled = True
    End Sub

    ' See if we should unhighlight the control.
    Private Sub Timer1_Timer()
    Dim pt As POINTAPI

    ' See where the cursor is.
    GetCursorPos pt

    ' Translate into window coordinates.
    ScreenToClient hwnd, pt

    ' See if we're still within the control.
    If pt.x < Label1.Left Or pt.y < Label1.Top Or _
    pt.x > Label1.Left + Label1.Width Or _
    pt.y > Label1.Top + Label1.Height _
    Then
    highlighted = False
    Label1.ForeColor = vbBlack
    Timer1.Enabled = False
    End If
    End Sub


    Let me know if it helped.

  13. #13

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    darkcloud

    Your solution is for highlighting text. My issue is concerning large images, I don't think that the two situations can even be compared. I do appreciate your help though. :-)

    Thanks,
    Daniel Christie

  14. #14
    Addicted Member
    Join Date
    Mar 2000
    Location
    bebenia, PA, USA
    Posts
    241

    mama

    mama mama; suckle suckel

  15. #15

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    It has been said that I should try to use a offscreen DC.
    Can anyone shed some light about how to properly use offscreen DC's?

    Thanks all,
    Daniel Christie

  16. #16
    Fanatic Member
    Join Date
    Apr 2000
    Location
    Whats a location?
    Posts
    516

    Question Did it screw up?

    Daniel, did my thing not work?

    I just want to know what went wrong. If you tell me, maybe
    I can revise the code.

    Thanks,

    Me
    Courgettes.

  17. #17

    Lightbulb

    V(ery)basic,

    I tried your code, and it worked with some sample images, but when I tried applying that theory to 10+ images, the rollover one way works, but not when the mouse moves away. Can you post a commented version of the code, so I can figure out what's up?

    THanx

Posting Permissions

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



Click Here to Expand Forum to Full Width