The theory and realization of the unified style and beautiful interface design
A Windows and Dialog boxes
Windows and dialogs are the same in our view, a quadrilateral, with a title bar, a system button, a border, and so on, movable and variable size. There is actually a difference between a window and a dialog box. There are two main processes that occur when you create a dialog window: The process of a dialog box and its window process. The Win32 SDK dialog box uses the System-provided dialog window's window procedure and dialog box procedure, which is invoked by the window procedure. Under MFC, all window classes use the same window procedure, as do dialog classes. The MFC dialog box process handles only wm_initdialog messages, and the rest is handled by the window process, and we have only the opportunity to handle the initialization of our dialog box in function OnInitDialog (). Therefore, we design the interface in the window process to implement the relevant messages to achieve our interface.
B. Several handling of dialog box window messages
1. Wm_ncpaint: Repaint non-customer area messages
Overload this elimination function so that you can do whatever you want on the title bar.
2. Wm_nclbuttondown: Press the left mouse button message on the non-client area
To have the left mouse button in the title bar, overload the elimination function
3. Wm_ncmousemove: Moving the mouse over a non-client area produces this message
4. Wm_size: This message is generated after the window has changed size.
In order to make the software more professional, adjust the size of the box, the controls inside should also be reasonable adjust the position and size,
Overloading this extinction function can achieve the purpose. There are a few, others are not introduced.
C. A unified interface style implementation
How to use the above knowledge please refer to my previous article "Let your Software interface more beautiful (i)" has introduced and has the source program. How the beautiful interface of the unified style is achieved will be the main content to be discussed in this article.
We know that Windows operating system window style is basically consistent, Microsoft's application software program and operating system style is basically unified. So making our CDialog the same, it's hard to change its interface style. Unless you know all about MFC, even understand the operating system kernel. I have been in the groping process after countless times, finally found hope.
Please look at the following two pictures:
Figure I
Figure II