?
Solved

Picture Box in VC++

Posted on 2001-07-02
5
Medium Priority
?
658 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 1

Accepted Solution

by:
hakob earned 200 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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

719 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