Solved

Picture Box in VC++

Posted on 2001-07-02
5
614 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Fast access to array, using indexes, smart iterative search 2 108
convert char array to number in c 5 83
True Type Font Files? 4 82
Best book to learn C++ 4 70
C++ Properties One feature missing from standard C++ that you will find in many other Object Oriented Programming languages is something called a Property (http://www.experts-exchange.com/Programming/Languages/CPP/A_3912-Object-Properties-in-C.ht…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
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 learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.

867 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now