enlarging an image (1 Viewer)

wort0987654321

Registered User.
Local time
Today, 14:53
Joined
Dec 5, 2002
Messages
90
on my form i have different images of cars dependant on what car is seleted from my combo box. when the image is shown i would like to be able to enlarge it with a command button or something.

any help would be useful.
thanks
 

Fornatian

Dim Person
Local time
Today, 14:53
Joined
Sep 1, 2000
Messages
1,396
There are a number of solutions to this, you could have a bigger image control present on the form and then toggle it's visbility when the 'enlarge' button is pressed. Alternatively you could alter the width/height of the original image control using something like

Me.MyPicture.Height = NewHeight
Me.MyPicture.Width = NewWidth
 

wort0987654321

Registered User.
Local time
Today, 14:53
Joined
Dec 5, 2002
Messages
90
is there a chance that you could show me this in more detail as i am finding this difficult.

i would prefer to use the first example that you have stated

thanks
 

Fornatian

Dim Person
Local time
Today, 14:53
Joined
Sep 1, 2000
Messages
1,396
Have these three controls on your form

1. A button called btnChangeSize
2. A small image control called imgSmall
3. A large image control called imgLarge

Set the visibility of imgLarge to 'No'.
Make the button's caption "Enlarge" (without quotes)
Now add this code to the buttons click event.
Code:
'toggle visibility of images
Me.imgBig.Visible = Not (imgBig.Visible)
Me.imgSmall.Visible = Not (imgSmall.Visible)
'change caption to be fancy
Me.btnChangeSize.Caption = IIf(Me.btnChangeSize.Caption = "Enlarge", "Shrink", "Enlarge")
End Sub
 

wort0987654321

Registered User.
Local time
Today, 14:53
Joined
Dec 5, 2002
Messages
90
i have entered the code that you have written and it enlarges and shrinks my image box as i would like. but it doesnt have the image in the image box when i select it from my combo box.

the image is in neither of the boxes.

could you help me to fix this problem.

thanks.
 

Fornatian

Dim Person
Local time
Today, 14:53
Joined
Sep 1, 2000
Messages
1,396
How do you relate the combo selection to the image? Is the smaller image bound to the countrol source, if so just bind both images to the same field. Otherwise if you obtain the image using a link to a file on your hard drive/network using a stored path then you need something like this in the change event of the combo box.

Me.imgSmall.Picture = Me.Combo '(if Me.Combo holds the entire path)
Me.imgLarge.Picture = Me.Combo '(if Me.Combo holds the entire path)

Make sense?
 

wort0987654321

Registered User.
Local time
Today, 14:53
Joined
Dec 5, 2002
Messages
90
i am finding this difficult to understand.

the images that appear when the car is selected from the conbo box are in the table of cars. the field is an ole image and ive attached a paint image which i copied from the internet.

so when a caertain car is selected it will bring up the picture which it is associated with in the table.
 

Fornatian

Dim Person
Local time
Today, 14:53
Joined
Sep 1, 2000
Messages
1,396
If this the case then just make a copy of the image control and resize and rename the image controls to imgLarge and imgSmall as I explained above. I never use embedded images in Access as these tend to cause massive database bloat, the best thing to do is store a text string which points at the file and then set the image controls picture property at run-time. Does this make sense? There is lots of examples of how to store images on this forum, just do a search and you should find some good guidance.
 

wort0987654321

Registered User.
Local time
Today, 14:53
Joined
Dec 5, 2002
Messages
90
im being very slow and cant understand what you mean. do you have an example of this that i could look at which will take me through the process step by step.

thank you for your help so far.
 

Users who are viewing this thread

Top Bottom