changing a picture's source upon mouseOver / mousedown / whatever :) 
Author Message
 changing a picture's source upon mouseOver / mousedown / whatever :)

Hi,

Right, continuing with my program, I've got 2 common dialog box controls.
There are 2 different pictures, and each one when clicked triggers one of
the common dialog boxes.  A questions has arisen from this that I would be
very grateful if you could help me with:

1)  When the user clicks on the picture, i.e. img1_Mousedown or whatever
can't quite remember it just now, how can I change the source of the
picture?  I thought about "img1.picture =", but would that not need a value
such as "c:\img1.gif"?  And when deployed, wouldn't the program look for the
graphic in that location?  So I need a way to include the graphic within the
program?

There was another question, but it's late and I've forgotten it; I
apologise, and will probably back tomorrow morning having remembered it :)

Thanks
Simon Yu



Sat, 27 Sep 2003 07:24:29 GMT  
 changing a picture's source upon mouseOver / mousedown / whatever :)
On Mon, 09 Apr 2001 23:24:29 GMT, "Simon Yu"

Add an imagelist, then you can refer to the picture objects within the
list.  image1.picture = imagelist1.listimages(1).picture etc..
Hm.. I just woke up and i can already relate to that second question
:-)

Quote:
>Hi,

>Right, continuing with my program, I've got 2 common dialog box controls.
>There are 2 different pictures, and each one when clicked triggers one of
>the common dialog boxes.  A questions has arisen from this that I would be
>very grateful if you could help me with:

>1)  When the user clicks on the picture, i.e. img1_Mousedown or whatever
>can't quite remember it just now, how can I change the source of the
>picture?  I thought about "img1.picture =", but would that not need a value
>such as "c:\img1.gif"?  And when deployed, wouldn't the program look for the
>graphic in that location?  So I need a way to include the graphic within the
>program?

>There was another question, but it's late and I've forgotten it; I
>apologise, and will probably back tomorrow morning having remembered it :)

>Thanks
>Simon Yu

Regards, Frank.


Sat, 27 Sep 2003 08:43:08 GMT  
 changing a picture's source upon mouseOver / mousedown / whatever :)

Quote:
> There was another question, but it's late and I've forgotten it; I
> apologise, and will probably back tomorrow morning having remembered it :)

> Thanks
> Simon Yu

I could have answered your first question, but I see that Hun (or was it
Hunette?) has already provided you with an answer. I already have an answer
ready for your second question, ready for me to simply "paste" into my
reply. In fact, I've got about three answers altogether. I just hope that
your question, when it arrives, is the right question ;-)

Mike



Sat, 27 Sep 2003 17:06:57 GMT  
 changing a picture's source upon mouseOver / mousedown / whatever :)
Good morning Simon,
Look at the App object and the LoadPicture function.

For example:
==============================
Option Explicit

Private Sub Form_Load()
    Set Image1.Picture = LoadPicture(App.Path & "\MouseUp.gif")
End Sub

Private Sub Image1_MouseDown(Button As Integer, Shift As Integer, X As
Single, Y As Single)
    Set Image1.Picture = LoadPicture(App.Path & "\MouseDown.gif")
End Sub

Private Sub Image1_MouseUp(Button As Integer, Shift As Integer, X As Single,
Y As Single)
    Set Image1.Picture = LoadPicture(App.Path & "\MouseUp.gif")
End Sub
==============================

You can put the picture-files in the same folder as the .exe is.
If you don't want to use 'external' files, you can choose between:
- create a resource file to hold the pictures,
- use an ImageList and add the pictures at design time,
- use 2 invisible ImageBoxes to hold the pictures.

Hope this helps,
Johan.



| Hi,
|
| Right, continuing with my program, I've got 2 common dialog box controls.
| There are 2 different pictures, and each one when clicked triggers one of
| the common dialog boxes.  A questions has arisen from this that I would be
| very grateful if you could help me with:
|
| 1)  When the user clicks on the picture, i.e. img1_Mousedown or whatever
| can't quite remember it just now, how can I change the source of the
| picture?  I thought about "img1.picture =", but would that not need a
value
| such as "c:\img1.gif"?  And when deployed, wouldn't the program look for
the
| graphic in that location?  So I need a way to include the graphic within
the
| program?
|
| There was another question, but it's late and I've forgotten it; I
| apologise, and will probably back tomorrow morning having remembered it :)
|
| Thanks
| Simon Yu
|
|



Sat, 27 Sep 2003 15:00:18 GMT  
 changing a picture's source upon mouseOver / mousedown / whatever :)

Quote:
> I could have answered your first question, but I see that Hun (or was it
> Hunette?) has already provided you with an answer. I already have an
answer
> ready for your second question, ready for me to simply "paste" into my
> reply. In fact, I've got about three answers altogether. I just hope that
> your question, when it arrives, is the right question ;-)

wow great or what??? :)  Unfortunately, it's one of those things that I know
I'm not going to remember until about a week in the future when I really,
*really* need it... anyway,  if you want, you can paste the three
hypothetical answers to my theoretical question anyway, I will read it
simply because one of them is probably likely to be the answer I would have
wanted anyway; and it's all good practice for a beginner.

Thanks all again
Simon Yu



Sun, 28 Sep 2003 04:15:42 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. HOW TO CHANGE PICTURE'S SOURCE?

2. Change Picture in a picturebox on mouseover?

3. Adding Mousedown / Mouseover to Combo Box

4. MouseDown event - Shift value doesn't change

5. recordset record position change upon the Datacombo change...

6. recordset record position change upon the Datacombo change...

7. recordset record position change upon the Datacombo change...

8. Change linked picture source?

9. 'MouseOver'???

10. Automatically Emailing upon 'submit'

11. Automatically Updating Embedded Graph Source if document's name is changed

12. changing a data report image control's source in code

 

 
Powered by phpBB® Forum Software