Load Picture on Image Control
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
|