Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 557
Default Load Picture on Image Control

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 226
Default 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

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to load JPG image TedT Excel Programming 1 September 20th 06 09:48 AM
Remove picture from Image Control? Jon[_22_] Excel Programming 1 April 10th 06 02:41 AM
Programatically control picture property of Image control Brassman[_5_] Excel Programming 5 May 24th 05 09:32 PM
Copy picture from image control Ian[_14_] Excel Programming 4 February 8th 05 02:48 PM
copy shape image into image control Luc Benninger Excel Programming 2 July 15th 04 11:14 AM


All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"