Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Picture Box in VC++

Posted on 2001-07-02
5
Medium Priority
?
665 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 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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

IntroductionThis article is the second in a three part article series on the Visual Studio 2008 Debugger.  It provides tips in setting and using breakpoints. If not familiar with this debugger, you can find a basic introduction in the EE article loc…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
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 member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

963 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