Bitmap Question
-
I have a doc/view program (sdi) and I want to be able to load and display bitmaps on the fly from .bmp files. I have an array of cells that the document keeps track of and I want the view to draw the correct bitmap who's filename will be stored in the cell object so that when OnDraw is called it looks up which bitmap it should be displaying and loads and displays it, opposed to having the bitmaps as resources. I have gathered that to load a specific bitmap you use the code... HBITMAP hImage = (HBITMAP)LoadImage(NULL, "c:\\nick.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE); but I cannot work out how to display it because everything I blit to the screen is blank. I've checked and the bitmap is loading ok, just not displaying. How do you do this? Cheers for any help Nick :confused:
-
I have a doc/view program (sdi) and I want to be able to load and display bitmaps on the fly from .bmp files. I have an array of cells that the document keeps track of and I want the view to draw the correct bitmap who's filename will be stored in the cell object so that when OnDraw is called it looks up which bitmap it should be displaying and loads and displays it, opposed to having the bitmaps as resources. I have gathered that to load a specific bitmap you use the code... HBITMAP hImage = (HBITMAP)LoadImage(NULL, "c:\\nick.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE); but I cannot work out how to display it because everything I blit to the screen is blank. I've checked and the bitmap is loading ok, just not displaying. How do you do this? Cheers for any help Nick :confused:
-
Thx a lot, looks like this'll work Nick :-D
-
I have a doc/view program (sdi) and I want to be able to load and display bitmaps on the fly from .bmp files. I have an array of cells that the document keeps track of and I want the view to draw the correct bitmap who's filename will be stored in the cell object so that when OnDraw is called it looks up which bitmap it should be displaying and loads and displays it, opposed to having the bitmaps as resources. I have gathered that to load a specific bitmap you use the code... HBITMAP hImage = (HBITMAP)LoadImage(NULL, "c:\\nick.bmp", IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE|LR_DEFAULTSIZE); but I cannot work out how to display it because everything I blit to the screen is blank. I've checked and the bitmap is loading ok, just not displaying. How do you do this? Cheers for any help Nick :confused:
An option I have used is using IPicture. It has a Render method that takes dc to draw the image onto. You can use gif, jpg, bmp, etc. Look in MSDN "How To Load and Display Graphics Files w/LOADPIC.EXE Q218972".