CfiledialogClass
Setbitmap
LoadImage
Dynamic Display of images
I. cfiledialog class
Constructor
Cfiledialog (bool bopenfiledialog, lpctstr lpszdefext = NULL, lpctstr
Lpszfilename = NULL, DWORD dwflags = ofn_hidereadonly |
Ofn_overwriteprompt, lpctstr lpszfilter = NULL, cwnd * pparentwnd = NULL );
Parameters
Bopenfiledialog
True: open, false, save
Lpszdefext
Default file extension. If you do not include an extension in the file name editing box, the extension defined by lpszdefext is automatically added to the file name. If it is null, no extension is added.
Lpszfilename
Default file name to open
Dwflags
Dialog Box flag
Ofn_hidereadonly // hide the read-only check box when enabled
Fn_overwriteprompt // when the file exists, a prompt box is displayed.
Ofn_readonly // the read-only check box is displayed.
Lpszfilter
The file extension list is as follows:
"Bitmap (*. BMP) | *. BMP | text file (*. txt) | *. txt | all files (*. *) | *. * | ";
Pparentwnd
Specify a parent window address
Ii. Picture control controls
Cstatic ::
Setbitmap |
Specifies a bitmap to be displayed in the static control. |
Getbitmap |
Retrieves the handle of the bitmap previusly set with setbitmap. |
Seticon |
Specifies an icon to be displayed in the static control. |
GetIcon |
Retrieves the handle of the icon previusly set with seticon. |
Setcursor |
Specifies a cursor image to be displayed in the static control. |
Getcursor |
Retrieves the handle of the cursor image previusly set with setcursor. |
Setenhmetafile |
Specifies an Enhanced Metafile to be displayed in the static control. |
Getenhmetafile |
Retrieves the handle of the Enhanced Metafile previusly set with setenhmetafile |
Iii. LoadImage Functions
Handle LoadImage (
Hinstance Hinst,// Handle of the instancecontaining the image
Lpctstr Lpszname,// Name or identifier ofimage
Uint Utype,// Type of image
Int Cxdesired,// Desired width
Int Cydesired,// Desired height
Uint Fuload// Load flags
);
// Load the image in the file
HBP = (hbitmap) LoadImage (null, filename, image_bitmap, 0, 0, lr_defaultsize | lr_loadfromfile );
// Load the image in the Resource
HBP = (hbitmap) LoadImage (afxgetapp ()-> m_hinstance, makeintresource (idb_bitmap2), image_bitmap, 0, 0, lr_defaultsize );
// Resize the image
HBP = (hbitmap) LoadImage (afxgetapp ()-> m_hinstance, makeintresource (idb_bitmap2), image_bitmap, 33,221, 0 );
// Release resources
Resource |
Release resource functions |
Bitmap |
Deleteobject |
Cursor |
Destroycursor |
Icon |
Destroyicon |