|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Bitmaps in dialogs.
does anybody know how to add a bitmap to a dialog?
|
|
#2
|
||||
|
||||
|
Short Answer: Yes I Do
Long Answer: You haven't specified what platform/environment you're using, so I'll assume Visual C++ on Windoze. 1. Go to the Resources Tab for your project. Right click on the resources and select Import... Select Files of type as "All Files" and select the BMP file that you wish to use for your dialog. You should then see something like IDB_BITMAP1 created under the Bitmap resources. 2. Next, go to your dialog box and select a Picture Component. Drag and drop this component on to your form 3. Right-click on the component and select Properties. Set Type to Bitmap and Image to IDB_BITMAP1 or whatever you got from step 1. Voila! |
|
#3
|
|||
|
|||
|
Sorry i didn't clarify. i am not using Visual C++, but Dev-C++ and there is no drag-and-drop and that, everything has to be typed out. Know how to do that? Oh, by the way, you were right about one thing, it IS for windows.
|
|
#4
|
|||
|
|||
|
USe GetDC() to get the DC of the area to draw.
Create a compatible DC with CreateCompatibleDC() LoadImage() the bitmap SelectObject() the bitmap into the compatible DC 'catching' the current bitmap (the return from SelectObject) Draw to the screen or buffer DC or render in the paint msg with BitBlt() or similar Return the original bitmap DeleteObject() the bitmap (put the DC back the way you created it before trying to release the GDI memory) ReleaseDC() any DC's from GetDC() DeleteDC() any you created This way the bitmap is not part of the .exe. Another way is to load (or include in the exe) a small tile bitmap and use a pattern brush to fill the DC's rect.
__________________
The essence of Christianity is told us in the Garden of Eden history. The fruit that was forbidden was on the Tree of Knowledge. The subtext is, All the suffering you have is because you wanted to find out what was going on. You could be in the Garden of Eden if you had just kept your f***ing mouth shut and hadn't asked any questions. Frank Zappa |
|
#5
|
||||
|
||||
|
For what it's worth, here's a code sample doing exactly what TechNoFear outlined above:
http://www.ssv-embedded.de/ssv/pc104/p113.htm |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Bitmaps in dialogs. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|