YOU CAN CODE!

 

With The Case Of UCanCode.net  Release The Power OF  Visual C++ !   HomeProducts | PurchaseSupport | Downloads  
Download Evaluation
Pricing & Purchase?
E-XD++Visual C++/ MFC Products
Overview
Features Tour 
Electronic Form Solution
Visualization & HMI Solution
Power system HMI Solution
CAD Drawing and Printing Solution

Bar code labeling Solution
Workflow Solution

Coal industry HMI Solution
Instrumentation Gauge Solution

Report Printing Solution
Graphical modeling Solution
GIS mapping solution

Visio graphics solution
Industrial control SCADA &HMI Solution
BPM business process Solution

Industrial monitoring Solution
Flowchart and diagramming Solution
Organization Diagram Solution

Graphic editor Source Code
UML drawing editor Source Code
Map Diagramming Solution

Architectural Graphic Drawing Solution
Request Evaluation
Purchase
ActiveX COM Products
Overview
Download
Purchase
Technical Support
  General Q & A
Discussion Board
Contact Us

Links

Get Ready to Unleash the Power of UCanCode .NET


UCanCode Software focuses on general application software development. We provide complete solution for developers. No matter you want to develop a simple database workflow application, or an large flow/diagram based system, our product will provide a complete solution for you. Our product had been used by hundreds of top companies around the world!

"100% source code provided! Free you from not daring to use components because of unable to master the key technology of components!"


MFC Source Code: File dialog with image preview WM_QUERYNEWPALETTE and WM_PALETTECHANGED

 
 

Introduction

There is no custom hook function, just common MFC message maps. The dialog has a CDibStatic member, which displays the preview image when available. The CDibStatic class encapsulates a static control that displays images and is described in an article in the static controls section.

This is how the dialog looks like:

The template for the dialog is a normal developer studio dialog template. Note however, the use of the stc32 static control. As it hasn't any text in it, it is invisible unless you select it. This static control will serve as a place holder for the standard file dialog controls, thus establishing the position of the newly added controls in respect to the standards. If there is no stc32 control specified in the template, all the new controls will be placed below the standard controls. Otherwise, the common file dialog will look at the size of the stc32 control to attempt to fit all the standard controls in it. If it is not big enough, it is resized to make room for the standard controls, and then the new controls are repositioned with respect to the resized stc32 control.

Palette support is included within the dialog class. It is implemented using handlers for the WM_QUERYNEWPALETTE and WM_PALETTECHANGED Windows messages, so you have to ensure in your program that the dialog receives these messages. If the palette never changes, the image is painted with the right palette selected the first time. Since the standard dialogs are modal, the palette changes can be due only to other applications (unless you change it in another thread), thus realizing palette when gaining focus should always maintain the right colors. You can realize the palette at any time you wish by sending a WM_QUERYNEWPALETTE message to the CDibStatic control, for instance.

This class has been used (among other things) to implement a completely object oriented DIBLOOK.

 

 

 

Copyright ?1998-2009 UCanCode.Net Software , all rights reserved.
Other product and company names herein may be the trademarks of their respective owners.

Please direct your questions or comments to webmaster@ucancode.net