 |
 |

05-30-2001, 11:34 AM
|
|
|
adding image to .exe file
|
hi all......how would one add a .bmp image into a .exe file sothat its part of the .exe file and not a seperate file.
ps...the image would be loaded onto a picture box control on a form.
thanks
john
|
|

05-30-2001, 11:57 AM
|
 |
Code Meister
Retired Moderator * Guru *
|
|
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
|
|
Re: adding image to .exe file
|
Just load the image into the picturebox at design time.
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|

05-30-2001, 12:52 PM
|
|
|
Re: adding image to .exe file
|
You can also use the imagelist control if you need to change the images a runtime. You save all the images in the control and then use it in your program.
The images must be saved a design time.
|
|

05-30-2001, 02:08 PM
|
|
Original Contributor
Retired Moderator * Guru *
|
|
Join Date: Jan 2001
Location: Watch Window
Posts: 2,781
|
|
Re: adding image to .exe file
|
You can also use a resource file that will become part of the exe.
JDT
|
__________________
JDT
|

05-30-2001, 02:45 PM
|
|
|
Re: adding image to .exe file
|
hi guys....i am not sure you understand what i want to do.at the moment i have a .bmp pic which is loaded at runtime into a picturebox control.the pic is thus viewable and changeable by all.what i want to do is to incorporate the .bmp pic into the main .exe fole sothat it cant be got at and viewed easily outside of the prog.
thanks guys
john
|
|

05-30-2001, 02:48 PM
|
|
Original Contributor
Retired Moderator * Guru *
|
|
Join Date: Jan 2001
Location: Watch Window
Posts: 2,781
|
|
Re: adding image to .exe file
|
I believe all three suggestions will do that.
JDT
|
__________________
JDT
|

05-30-2001, 03:08 PM
|
 |
Code Meister
Retired Moderator * Guru *
|
|
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
|
|
Re: adding image to .exe file
|
The loadable at runtime part is easy. For instance, if you put the image into an imagelist, you can copy it from the list to your control at runtime.
The changable part is a bit more problematic. Are you saying you wish to allow the users to modify the bitmap, ie add lines or text to it, then save it? Or are you saying you wish to allow users to change one bitmap for another?
If you wish to swap bitmaps, then just pick another image from the image list. But if you wish to SAVE an image in your EXE, then that IS a problem....
Thereoretically, it should be possible to save the new BMP over the old one stored in the RES file in your EXE. But I don't know how to do that yet....Also, it might not be possible for a program to modify it's own resource file.
Another possibility is to store the image in the Registry. It would certainly be more difficult to find...
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|

05-30-2001, 03:14 PM
|
|
|
Re: adding image to .exe file
|
hi again.....basically the pic is a map,which comprises of squares like a grid,and one can click on each sqaure and paste a color to it ...say red. this map is a .bmp file and is in the app.path folder during runtime.the map can be saved and recalled at any time.i was thinking of placing it inside a dll,but bot sure how to do this.the idea is to make the map accessible only from within the prog and not viewable otherwise.
|
|

05-30-2001, 03:43 PM
|
 |
Code Meister
Retired Moderator * Guru *
|
|
Join Date: Aug 2000
Location: Vancouver, BC, Canada
Posts: 10,441
|
|
Re: adding image to .exe file
|
If it's as simple as you say, then you could make your own file type. You could have the locations (X,y coordinates) of the squares and their colours. This would take up a lot less space than a BMP file, which stores 1 byte per pixel.
But if you wish to save a bmp file anyway, then you should be able to save it to the registry.
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|
__________________
"I have a plan so cunning you could put a tail on it and call it a weasel!" - Edmund Blackadder
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|