Changing the background picture on a form with code 
November 13th, 2005, 11:36 AM
| | | Changing the background picture on a form with code
Hi there everyone,
I have a part info form which has a faded image of our company logo as a
background.
I want to replace the faded image with a bright red warning image on items
which have run out of purchasing cover.
I am nearly there, the only problem is that the code below only changes the
image background for text and combo-box backgrounds, it doesn't apply it to
the whole form.
This is the code I am using
If Me!GLTB = "Expired" Then
Me.Form.Picture = "P:\BAESRLREDDB.gif"
ElseIf Me!GLTB = "Valid" Then
Me.Form.Picture = "P:\BAESRLBLACKDB.gif"
end if
Another minor annoyance is that access flashes up an "importing picture"
window momentarilly.
Is there a way to avaoid this by assigning the pictures to variables in the
VB code or similar?
Any help greatly appreciated,
Thanks,
John | 
November 13th, 2005, 11:37 AM
| | | Re: Changing the background picture on a form with code
"John Ortt" wrote
[color=blue]
> . . . replace the faded image with a bright
> red warning image on items which have
> run out of purchasing cover.
>
>. . . problem . . . code below only changes
> the image background for text and combo-
> box backgrounds, it doesn't apply it to
> the whole form.
> If Me!GLTB = "Expired" Then
> Me.Form.Picture = "P:\BAESRLREDDB.gif"
> ElseIf Me!GLTB = "Valid" Then
> Me.Form.Picture = "P:\BAESRLBLACKDB.gif"
> end if[/color]
The only thing I can think of is that your pictures are not only not the
same size, but not the same height-width proportions. But, I don't
understand why you use "Me.Form.Picture" -- to check that I wasn't
misremembering this, I did something similar and used "Me.Picture".
Mine was slow, but I expected that, as I used jpg pictures that I happened
to have handy, which were not "small", and the PictureSizeMode property of
Zoom, so they not only had to be translated to device independent bitmaps,
but resized as well.
Because the picture and form did not have identical dimensions, my picture
filled the form from top-to-bottom, but not from side-to-side (that's the
way Zoom works). I resized the Form so the picture filled it, and when I
replaced the Picture property with the path-and-filename of an
identically-sized picture, it filled the entire form, too.
Unless there is some reason, I suggest you use Me.Picture instead of
Me.Form.Picture, and that you use your image processing software to resize
your image to the size of the form, reduce the resolution to screen
resolution (which you'll need to look up...VGA is 72 pixels per inch, and
SVGA is 96, as I recall, but newer computers have different ppi
requirements). And, I suspect there will be less "translation" to do if you
save it as a .BMP -- but I am not enough of an imaging expert to say that
for sure. Then do the same thing with your alternate image.
My guess is that the "shape" of your two images is not identical and that
the second one may just be filling the form in one direction, either
horizontal or vertical.
I do not have an answer for your question about the loading progress bar.
The approach I had in mind was using DoCmd.Echo False before setting the
picture property and DoCmd.Echo True afterwards, but the progress bar
appeared anyway.
Larry Linson
Microsoft Access MVP | 
November 13th, 2005, 11:38 AM
| | | Re: Changing the background picture on a form with code
"Larry Linson" <bouncer@localhost.not> wrote in message
news:au0xe.16193$gm6.14448@trnddc05...
[color=blue]
> The only thing I can think of is that your pictures are not only not the
> same size, but not the same height-width proportions. But, I don't
> understand why you use "Me.Form.Picture" -- to check that I wasn't
> misremembering this, I did something similar and used "Me.Picture".
>
> Mine was slow, but I expected that, as I used jpg pictures that I happened
> to have handy, which were not "small", and the PictureSizeMode property of
> Zoom, so they not only had to be translated to device independent bitmaps,
> but resized as well.
>
> Because the picture and form did not have identical dimensions, my picture
> filled the form from top-to-bottom, but not from side-to-side (that's the
> way Zoom works). I resized the Form so the picture filled it, and when I
> replaced the Picture property with the path-and-filename of an
> identically-sized picture, it filled the entire form, too.
>
> Unless there is some reason, I suggest you use Me.Picture instead of
> Me.Form.Picture, and that you use your image processing software to resize
> your image to the size of the form, reduce the resolution to screen
> resolution (which you'll need to look up...VGA is 72 pixels per inch, and
> SVGA is 96, as I recall, but newer computers have different ppi
> requirements). And, I suspect there will be less "translation" to do if[/color]
you[color=blue]
> save it as a .BMP -- but I am not enough of an imaging expert to say that
> for sure. Then do the same thing with your alternate image.
>
> My guess is that the "shape" of your two images is not identical and that
> the second one may just be filling the form in one direction, either
> horizontal or vertical.
>
> I do not have an answer for your question about the loading progress bar.
> The approach I had in mind was using DoCmd.Echo False before setting the
> picture property and DoCmd.Echo True afterwards, but the progress bar
> appeared anyway.
>
> Larry Linson
> Microsoft Access MVP
>[/color]
Thanks for the reply Larry,
Unfortunately the two images are identical dimensions (I used the same image
but colourised and changed the hue to red).
The images are saved as .Gif's and are approximately 100 x 100 pixels. I
have them set to tile at the moment rather than zoom.
I did try the Me.Picture method prior to the Me.Form.Picture but the results
were exactly the same.
Since posting I have found a way round the issue of not refreshing the
background by momentarilly setting the tiling property to false and then
re-enabling it.
I did try Me.Refresh and Me.Repaint but these didn't do the trick....
I still want to find a way round the loading progress bar issue but it isn't
a big problem.
Thanks again for your suggestions,
John | 
November 13th, 2005, 11:39 AM
| | | Re: Changing the background picture on a form with code
This may not be a very satisfactory solution for you, but I shrunk some
sample databases _considerably_ by removing the "texture" (tiled) images
from the forms, and just using a color on the background. I'm reasonably
sure you'd get better performance that way, too. The samples I originally
create were too large for people using dial-up to download.
Larry Linson
Microsoft Access MVP
"John Ortt" <JohnOrtt@Idontwantspamsonoreturnaddress.com> wrote in message
news:42c50f7f$1_1@glkas0286.greenlnk.net...[color=blue]
>
> "Larry Linson" <bouncer@localhost.not> wrote in message
> news:au0xe.16193$gm6.14448@trnddc05...
>[color=green]
> > The only thing I can think of is that your pictures are not only not the
> > same size, but not the same height-width proportions. But, I don't
> > understand why you use "Me.Form.Picture" -- to check that I wasn't
> > misremembering this, I did something similar and used "Me.Picture".
> >
> > Mine was slow, but I expected that, as I used jpg pictures that I[/color][/color]
happened[color=blue][color=green]
> > to have handy, which were not "small", and the PictureSizeMode property[/color][/color]
of[color=blue][color=green]
> > Zoom, so they not only had to be translated to device independent[/color][/color]
bitmaps,[color=blue][color=green]
> > but resized as well.
> >
> > Because the picture and form did not have identical dimensions, my[/color][/color]
picture[color=blue][color=green]
> > filled the form from top-to-bottom, but not from side-to-side (that's[/color][/color]
the[color=blue][color=green]
> > way Zoom works). I resized the Form so the picture filled it, and when I
> > replaced the Picture property with the path-and-filename of an
> > identically-sized picture, it filled the entire form, too.
> >
> > Unless there is some reason, I suggest you use Me.Picture instead of
> > Me.Form.Picture, and that you use your image processing software to[/color][/color]
resize[color=blue][color=green]
> > your image to the size of the form, reduce the resolution to screen
> > resolution (which you'll need to look up...VGA is 72 pixels per inch,[/color][/color]
and[color=blue][color=green]
> > SVGA is 96, as I recall, but newer computers have different ppi
> > requirements). And, I suspect there will be less "translation" to do if[/color]
> you[color=green]
> > save it as a .BMP -- but I am not enough of an imaging expert to say[/color][/color]
that[color=blue][color=green]
> > for sure. Then do the same thing with your alternate image.
> >
> > My guess is that the "shape" of your two images is not identical and[/color][/color]
that[color=blue][color=green]
> > the second one may just be filling the form in one direction, either
> > horizontal or vertical.
> >
> > I do not have an answer for your question about the loading progress[/color][/color]
bar.[color=blue][color=green]
> > The approach I had in mind was using DoCmd.Echo False before setting the
> > picture property and DoCmd.Echo True afterwards, but the progress bar
> > appeared anyway.
> >
> > Larry Linson
> > Microsoft Access MVP
> >[/color]
>
> Thanks for the reply Larry,
>
> Unfortunately the two images are identical dimensions (I used the same[/color]
image[color=blue]
> but colourised and changed the hue to red).
>
> The images are saved as .Gif's and are approximately 100 x 100 pixels. I
> have them set to tile at the moment rather than zoom.
>
> I did try the Me.Picture method prior to the Me.Form.Picture but the[/color]
results[color=blue]
> were exactly the same.
>
> Since posting I have found a way round the issue of not refreshing the
> background by momentarilly setting the tiling property to false and then
> re-enabling it.
>
> I did try Me.Refresh and Me.Repaint but these didn't do the trick....
>
> I still want to find a way round the loading progress bar issue but it[/color]
isn't[color=blue]
> a big problem.
>
> Thanks again for your suggestions,
>
> John
>
>[/color] | 
November 13th, 2005, 11:42 AM
| | | Re: Changing the background picture on a form with code
Thanks for the tip Larry,
I was worried about that and for that reason I linked to the images instead
of embedding them in the program.
Does it have an effect on file size even if you are only linking to the
image?
I have to confess I didn't check as I assumed it didn't.
"Larry Linson" <bouncer@localhost.not> wrote in message
news:jrjxe.5279$mr4.3355@trnddc05...[color=blue]
> This may not be a very satisfactory solution for you, but I shrunk some
> sample databases _considerably_ by removing the "texture" (tiled) images
> from the forms, and just using a color on the background. I'm reasonably
> sure you'd get better performance that way, too. The samples I originally
> create were too large for people using dial-up to download.
>
> Larry Linson
> Microsoft Access MVP[/color] | 
November 13th, 2005, 11:44 AM
| | | Re: Changing the background picture on a form with code
I've done no work with linked pictures as form background, but linked images
as OLE objects did not reduce file size significantly, because Access and
the COM-enabled software that processes that type of image file still create
a _bitmap_ thumbnail that is far bigger than an original JPG or GIF at full
size and store it in the OLE object field.
Larry Linson
Microsoft Access MVP
"John Ortt" <JohnOrtt@Idontwantspamsonoreturnaddress.com> wrote in message
news:42c8ee9e_1@glkas0286.greenlnk.net...[color=blue]
> Thanks for the tip Larry,
>
> I was worried about that and for that reason I linked to the images
> instead
> of embedding them in the program.
>
> Does it have an effect on file size even if you are only linking to the
> image?
>
> I have to confess I didn't check as I assumed it didn't.
>
> "Larry Linson" <bouncer@localhost.not> wrote in message
> news:jrjxe.5279$mr4.3355@trnddc05...[color=green]
>> This may not be a very satisfactory solution for you, but I shrunk some
>> sample databases _considerably_ by removing the "texture" (tiled) images
>> from the forms, and just using a color on the background. I'm reasonably
>> sure you'd get better performance that way, too. The samples I originally
>> create were too large for people using dial-up to download.
>>
>> Larry Linson
>> Microsoft Access MVP[/color]
>
>
>[/color] | 
November 13th, 2005, 11:44 AM
| | | Re: Changing the background picture on a form with code
Ahh, Ok.
Thanks Larry, might have to have a rethink on my design :)
"Larry Linson" <bouncer@localhost.not> wrote in message
news:nCoye.3068$kh3.1204@trnddc03...[color=blue]
> I've done no work with linked pictures as form background, but linked[/color]
images[color=blue]
> as OLE objects did not reduce file size significantly, because Access and
> the COM-enabled software that processes that type of image file still[/color]
create[color=blue]
> a _bitmap_ thumbnail that is far bigger than an original JPG or GIF at[/color]
full[color=blue]
> size and store it in the OLE object field.
>
> Larry Linson
> Microsoft Access MVP
>
> "John Ortt" <JohnOrtt@Idontwantspamsonoreturnaddress.com> wrote in message
> news:42c8ee9e_1@glkas0286.greenlnk.net...[color=green]
> > Thanks for the tip Larry,
> >
> > I was worried about that and for that reason I linked to the images
> > instead
> > of embedding them in the program.
> >
> > Does it have an effect on file size even if you are only linking to the
> > image?
> >
> > I have to confess I didn't check as I assumed it didn't.
> >
> > "Larry Linson" <bouncer@localhost.not> wrote in message
> > news:jrjxe.5279$mr4.3355@trnddc05...[color=darkred]
> >> This may not be a very satisfactory solution for you, but I shrunk some
> >> sample databases _considerably_ by removing the "texture" (tiled)[/color][/color][/color]
images[color=blue][color=green][color=darkred]
> >> from the forms, and just using a color on the background. I'm[/color][/color][/color]
reasonably[color=blue][color=green][color=darkred]
> >> sure you'd get better performance that way, too. The samples I[/color][/color][/color]
originally[color=blue][color=green][color=darkred]
> >> create were too large for people using dial-up to download.
> >>
> >> Larry Linson
> >> Microsoft Access MVP[/color]
> >
> >
> >[/color]
>
>[/color] | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,840 network members.
|