www.pudn.com > mfc资源大全1.rar > bmp_in_mdiclient2.shtml
Bitmap - Bitmap background in MDI Client (2)
This code was contributed by David Simpson.
The zipped up project is an extended version of the code provided by Neil A. Van Note. I initially used Neil's code, but ran into a problem initially as the code did not properly handle 256 color bitmap The CMdiClient code has been changed to load a bitmap from a file or a resource as a DIB. Many classes have been written that implement DIBs, however these provide far more functionality than is required here. Thus reading and loading DIBs is handled directly by the CMdiClient class, and thus this sample also provides a good example of how to do this. The code for reading a bitmap from file is lifted directly from the WinCap sample from MSDN. Most of the DIB handling is done directly through the SDK calls merely for convenience in this instance.
The sample also implements a property sheet for setting, previewing and applying the background bitmaps. The options property page allows the user to assign a background from a selection of resources or to use an external bitmap file, much in the same way as the Windows desktop. You also have the option to tile or centre the bitmap.
A property sheet was used here in my own app which has many user option sheets, but this could easily be implemented in a dialog. All the settings for the user are preserved in the registry.
In my own implemetation of this, I also have an option to define a background color as well as the bitmap. The code is included in this sample but is commented out as the property page uses one of Stingray's Toolkit controls, the SECColorWell button. You can easilly implement your own version of this, but I can definitely recommend the Stingray libraries for any serious users.
This code is far from perfect and any comments are welcome. One thing I know I haven't bothered doing is providing a preview facility for external bitmaps, but it should be trivial to do.
As ever your welcome to use this code in any way you like, but neither I nor the company I work for are liable for nasty things it might decide to do.
| Goto HomePage |
|
Contact me: zafir@home.com
|