Home All Groups Group Topic Archive Search About
Author
22 Oct 2005 9:39 AM
Arpan
I want a background image/picture for my VB6 application that has 3
Forms (not the controls). How do I do that? I tried to set the
"Picture" property of the Form but that doesn't do the needful.

Please note that I want the background image for all the 3 Forms.

Thanks,

Arpan

Author
22 Oct 2005 10:48 AM
Larry Serflaten
"Arpan" <arpan***@hotmail.com> wrote
> I want a background image/picture for my VB6 application that has 3
> Forms (not the controls). How do I do that? I tried to set the
> "Picture" property of the Form but that doesn't do the needful.

Why not?

> Please note that I want the background image for all the 3 Forms.

Then re-assign the pictures as you show the form's:

Form2.Picture = Me.Picture
Form2.Show
Author
22 Oct 2005 11:03 AM
Arpan
>>Why not?

No idea why? If I am not mistaken, the image should cover all those
areas of the Form that aren't occupied by the different controls i.e.
the space in between the different controls should show the image but
that doesn't happen; the background image covers only a part of the
empty space.

>>Then re-assign the pictures as you show the form's:

Form2.Picture = Me.Picture
>>Form2.Show

Tried this as well but that doesn't make any difference.

Any other suggestion?

Thanks,

Regards,

Arpan
Author
22 Oct 2005 1:35 PM
J French
On 22 Oct 2005 04:03:53 -0700, "Arpan" <arpan***@hotmail.com> wrote:

>>>Why not?
>
>No idea why? If I am not mistaken, the image should cover all those
>areas of the Form that aren't occupied by the different controls i.e.
>the space in between the different controls should show the image but
>that doesn't happen; the background image covers only a part of the
>empty space.

Which part does it NOT cover ?

You probably want to stretch draw the Picture

Look at the Form.PaintPicture method
Author
22 Oct 2005 1:44 PM
David Youngblood
"Arpan" <arpan***@hotmail.com> wrote...
> >>Why not?
>
> No idea why? If I am not mistaken, the image should cover all those
> areas of the Form that aren't occupied by the different controls

No,  the form's picture does not resize to fit the form. If you want the picture
to always fit the form, you might try an image control which has a stretch
property.

Private Sub Form_Load()
    Image1.Stretch = True
    Image1.Picture = LoadPicture("C:\My Documents\My Pictures\Iceberg.jpg")
End Sub

Private Sub Form_Resize()
    Image1.Move 0, 0, Me.ScaleWidth, Me.ScaleHeight
End Sub

David
..
Show quoteHide quote
> the space in between the different controls should show the image but
> that doesn't happen; the background image covers only a part of the
> empty space.
>
> >>Then re-assign the pictures as you show the form's:
>
> Form2.Picture = Me.Picture
> >>Form2.Show
>
> Tried this as well but that doesn't make any difference.
>
> Any other suggestion?
>
> Thanks,
>
> Regards,
>
> Arpan
>
Author
22 Oct 2005 2:14 PM
Mike Williams
"Arpan" <arpan***@hotmail.com> wrote in message
news:1129979033.622888.216740@g49g2000cwa.googlegroups.com...

> No idea why? If I am not mistaken, the image should cover all
> those areas of the Form that aren't occupied by the different
> controls i.e.the space in between the different controls should
> show the image but that doesn't happen; the background image
> covers only a part of the empty space.

Right. It looks as though your image (.bmp, jpg or whatever) has a pixel
size that is smaller than the Form. In that case there are various options.
One way would be to set your Form's Autoredraw property to True and to paint
your image onto the Form at the appropriate size using the VB PaintPicture
method. Note that the pixel size of the Form's Autoredraw Image is the same
size as the client area of the Form (if it is a fixed size Form) and the
same size as the screen (800 x 600 or whatever) if it is a Sizeable Form.
However, you need to be aware that "stretching" images to a size that is
larger than their original pixel size will produce a poor quality picture.
You'd be far better off finding a suitable image that is as large as
possible (and preferably the same size or larger than the size of the
display).

Mike
Author
22 Oct 2005 4:02 PM
Arpan
I must say that experts in this newsgroup are really forthcoming. Post
one query & within the next 30 minutes, there will be different
suggestions/solutions accompanying the query. The gurus are ready to
pounce in to guide needy people like me. Great work.....keep it up & I
really mean each & every word I have said above. A zillion thanks won't
be enough to reciprocate.

Thanks to one & all for your inputs. I finally settled for David's
suggestion.

Regards,

Arpan
Author
22 Oct 2005 11:01 AM
Mike Williams
"Arpan" <arpan***@hotmail.com> wrote in message
news:1129973955.829026.92920@g49g2000cwa.googlegroups.com...

> I tried to set the "Picture" property of the Form but that doesn't
> do the needful.

What do you mean by, "It doesn't do the needful". Setting the Picture
property of a Form (either at runtime or in the VB IDE) will cause that
picture to be displayed as the Form's background. Isn't that what you want?

> Please note that I want the background image for all the 3 Forms.

.. . . or is it perhaps that it did indeed "do the needful" for the Form that
you specified but that you were hoping it would also automatically do it for
all three Forms? (Best if you can be as specific as possble whgen posting
querstions).

You can, of course, simply set each of the three Forms' Picture properties
to the same picture at design time. That, however, would result in the same
picture data being included three times in your compiled exe (which is
perhaps what you are trying to avoid). In that case just set one Picture
property at design time and then set the others to the same picture in code
at run time. There are all sorts of different ways of doing it, but you'll
need to tell us exactly what you want to do, and why.

Mike
Author
22 Oct 2005 1:44 PM
Rick Rothstein [MVP - Visual Basic]
> I want a background image/picture for my VB6 application that
has 3
> Forms (not the controls). How do I do that? I tried to set the
> "Picture" property of the Form but that doesn't do the needful.

Where is the background picture stored at? In a file? If so,
assign it to the form this way...

Set Form1.Picture =
LoadPicture("c:\Directory\Path\YourPicture.bmp")

> Please note that I want the background image for all the 3
Forms.

Just do the above assignment to each form's Picture property. If
these assignment are "permanent" and non-changing, you could
assign the picture file to the Picture property at design time
using the Property Window.

Rick