Load Picture on Image Control

K

K

Hi all, I have "Image Control (ActiveX Control)" on my sheet and with
code below when I take my mouse pointer on that "Image Control" it
loads the picture "b2.bmp" on it. I want some code line in code below
that as soon as I take my mouse pointer off from that "Image Control"
picture "b1.bmp" should get loaded. In other words i want picture
"b2.bmp" to be loaded on "Image Control" when i take my curser or
mouse pointer on it (which i have achived in code below) and when i
take my curser or mouse pointer off from "Image Control" then picture
"b1.bmp" should be get loaded on "Image Control". Please any friend
can help me on this.

CODE:-

Private Sub Image1_MouseMove(ByVal Button As Integer, ByVal Shift As
Integer, ByVal X As Single, ByVal Y As Single)
Image1.Picture = LoadPicture("C:\Documents and Settings\My Documents
\My Pictures\b2.bmp")
End Sub
 
I

Incidental

Hi K

I have come across similar issues with worksheets and the code below
is one method that tries to get around the problem, it may give you
more problems than you started with but i thought i would post and let
you decide. First a bit of explaining, you are going to need to
create a control that is bigger than your image control not to much
bigger just enough to create a thin boarder around it. I tend to use
labels allot so for that reason i am going to say make a label don't
bother changing the name but do however remove the caption and set the
back style to fmBackStyleTransparent, this will hide it from view.
Next create an image control with the default name and place it on top
of you label then in the code module for the sheet paste the code
below.

This method is of course not without its problems as i said which stem
from the fact that if you click an activeX control on a worksheet it
is brought to the front and in this case will show the label as a
white box that hides the image control, you can reduce the risk of the
user clicking the label a little by making it smaller, just
fractionally bigger than the image control however this also has the
problem of if the user moves the mouse to quickly the mouse_move event
for the label wont register and you don't get the effect you are
after.

I have found that if i want the user to click on the image, say using
it like a button i would make the picture i want to use slightly
smaller than the actual image control to try and ensure that the user
will actually have the mouse over the image when the click.

Anywho i hope this at least gives you some food for thought.

Cheers

Steve

Private Sub Label1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Image1.Picture = LoadPicture("C:\Documents and Settings\" & _
"My Documents\My Pictures\b1.bmp")

End Sub

Private Sub Image1_MouseMove(ByVal Button As Integer, _
ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)

Image1.Picture = LoadPicture("C:\Documents and Settings\" & _
"My Documents\My Pictures\b2.bmp")

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top