🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.basic.visual
Article #194

Re: HELP: Mouseover in VB5

#194
From: Gustavo Huffenbacher Daud
Date: Mon, 26 Jan 1998 00:00
36 lines
2446 bytes
There a easy way to do it.
First of all, you must include this api declaration into your file:

Private Declare Function SetCapture Lib "user32" (ByVal hwnd As Long) As Long
Private Declare Function ReleaseCapture Lib "user32" () As Long

Due to some api limitations, you can only use this to controls that have the
.hwnd, but I'm sure that you'll figure out how to fix this.

Let's suppose that you want that a picturebox (picture1) changes its color when
the user moves the mouse in and return to the original color when the user moves
the mouse out.

Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single,
Y As Single)
With Picture1

    If Button = 0 Then ' To this only if no button is pressed
        If (X < 0) Or (Y < 0) Or (X > .Width) Or (Y > .Height) Then
            'When the cursor goes out:
            ReleaseCapture
            .backcolor=.forecolor
            Else
            'When the cursor goes in
            SetCapture .hwnd
            .forecolor = .backcolor
            .backcolor=rgb(255,100,0)

        End If
    End If
End With

End Sub

Now just change this code to use other controls !!
Technical Details
Message-ID: <34CCA9C6.5B6BF605@geocities.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <6ah785$pfd@examiner.concentric.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 104093,fa28485b62046a5
X-Google-Attributes: gid104093,public
X-Google-Thread: 10b997,fa28485b62046a5
X-Google-Attributes: gid10b997,public
X-Google-Thread: 10b213,fa28485b62046a5
X-Google-Attributes: gid10b213,public
X-Google-Thread: 110e3b,fa28485b62046a5
X-Google-Attributes: gid110e3b,public
X-Google-Thread: fb992,fa28485b62046a5
X-Google-Attributes: gidfb992,public
X-Google-Thread: 10127e,fa28485b62046a5
X-Google-Attributes: gid10127e,public
X-Google-Thread: f645d,fa28485b62046a5
X-Google-Attributes: gidf645d,public
X-Google-Thread: 108062,fa28485b62046a5
X-Google-Attributes: gid108062,public
From: Gustavo Huffenbacher Daud <guba@geocities.com>
Subject: Re: HELP: Mouseover in VB5
Date: 1998/01/26
Message-ID: <34CCA9C6.5B6BF605@geocities.com>
X-Deja-AN: 319353165
Content-Transfer-Encoding: 7bit
References: <6ah785$pfd@examiner.concentric.net>
Content-Type: text/plain; charset=us-ascii
MIME-Version: 1.0
Newsgroups: comp.lang.basic.visual,comp.lang.basic.visual.misc,comp.lang.visual.basic,cz.comp.lang.basic.visual,it.comp.lang.visual-basic,microsoft.public.es.vb,microsoft.public.vb.controls,microsoft.public.vb.winapi,microsoft.public.vb.winapi.graphics,micro