This example shows how to draw a custom (custom-drawn) window frame (including headings, borders, and so on).
First, the preface
Today, software that supports custom skin features is becoming more popular. This allows users to modify the appearance of the program themselves. Even the Windows operating system itself did this. The theme (theme) technology provided by Windows XP can modify the appearance of Windows, buttons, scrollbars, and so on.
Recently, I want to use MFC to design a skin-changing program. I didn't search for anything I wanted on the internet, so I decided to write one myself. This is not a difficult problem, but it needs to be familiar with the mechanism of the Windows operating system's drawing window.
Second, background
I have provided some of the following classes:
1. The Cskinwin----Cskinwin class is a class that draws custom (custom-painted) Windows. It draws the top, bottom, left, right, and title bar buttons such as Maximize, close buttons. To do this, the Cskinwin class reads the configuration information from an INI file, configuring the bitmap for each border in the INI file. It should be noted that the format of the INI file is copied from the UIs format of Windows blinds (Stardock's masterpiece), because I want to support the topic of Windows Blinds in my program.
2. Cskinbutton---Cskinbutton class is a class that draws custom (custom) buttons. It represents a normal, focused, pressed, and invalid state with four bitmaps respectively. Bitmap format is also a Windows blinds format, and parameters are defined in the same INI file. Because a window has more than one button instance, I designed the Cskinbuttonresource class to store the skin of the custom (self-painting) button.
3. Cmybimtap---Some related classes, some of which are from CodeProject. Although I do not remember these authors, I would like to thank them.