Solved

Picture Box in VC++

Posted on 2001-07-02
5
627 Views
Last Modified: 2013-12-03
I guess this is simple but how do you load an image into a picture box in VC++?
I've got a dialog form with an OK and Cancel button and I've loaded a picture box from the Controls toolbox. In the properties dialog of the picture box box there are 2 drop down combos. One allows me to pick Bitmap for the type of image but the other one (for picking the actual image) is blank. Do I have to load images into the project somehow?
0
Comment
Question by:ianch
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
hakob earned 50 total points
ID: 6247340
Hello,

If you choose "Bitmap" in the first combo box, the second combo box shows all bitmaps, which are contained in the project resource yet, with their resource id. This ids will be shows on the combo to choose the bitmap. It does not trace the directories to find bitmap files, etc.

With Visual C++ you can either create new bitmap in the project resources or insert existing bitmap into there.

To create new bitmap, choose the menu
"Insert" -> "Resource", select "Bitmap" and press "New".
This will create bitmap file with the resource id like IDB_BITMAP1, which will be shown in the second combo box.
You can draw now this bitmap.

To load the existing bitmap into the project, choose the menu "Insert" -> "Resource", select "Bitmap" and press "Import". This will show the directory tree in your PC and you should choose "All files" in the "Files of type" combo box therein. Then select the bitmap you want (for example, choose c:\windows\setup.bmp). Then press "Import". This will add the selected bitmap to your project resources with the id f.e. IDB_BITMAP2.

So, now, your second combo box will show the IDs of 2 bitmap files: IDB_BITMAP1 and IDB_BITMAP2. You can choose between them.

Thank you
0
 

Author Comment

by:ianch
ID: 6250816
Excellent Hakob,
I loaded the image OK but it is now covering up the 2 buttons on the dialog form.
I'll increase the points to 100 if you can tell me:
1. How to bring the buttons back on top
2. How to change the color and font size of the text in the static text box I have put on the dialog form.

ianch
0
 
LVL 30

Expert Comment

by:Axter
ID: 6250827
>>How to bring the buttons back on top
Use the TAB option.  You'll find this under the main menu.
[Layout]->[Tab Order]

Change the tab order to reflect which control you want on top.
0
 
LVL 30

Expert Comment

by:Axter
ID: 6250828
>>How to change the color and font size of the text in the
>>static text box I have put on the dialog
>>form.
You would have to create your own CStatic control to do this.
An easier way to do it would be to make a bitmap with the desired colored text.
0
 

Author Comment

by:ianch
ID: 6251088
Thanks Axter but I have to give the points to hakob
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.
The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

821 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