How to Stretch Background Picture?

Posted on 2005-04-15
Medium Priority
Last Modified: 2008-02-01
I use a PictureBox as a container for one 'panel' on an MDI form.  The graphic (jpg) that I want to use as the backround picture is shorter than the height of the panel.  Thus when I load the graphic it only shows a background for the top 3/4 of the picturebox and then stops.  Are there any options to set which will 'stretch' the graphic to fit the entire area of the picture box.

When I have preiously placed pictures in an image control on the form there was s 'stretch' property to accomodate this.  There is no corresponding property on a picturebox control.

Any suggestions?
Question by:mlcktmguy
1 Comment
LVL 38

Accepted Solution

PaulHews earned 500 total points
ID: 13794888
Private Sub Picture1_Paint()
    Picture1.PaintPicture LoadPicture("C:\temp\1.jpg"), 0, 0, Picture1.Width, Picture1.Height
End Sub

If you want to store the picture in the picturebox at design time, you can load it into a second picture box, set the visible to false on the second and write the paint procedure like this:

Private Sub Picture1_Paint()
    Picture1.PaintPicture Picture2.Picture, 0, 0, Picture1.Width, Picture1.Height
End Sub

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Suggested Courses

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question