[00002]-[2015-06-27]-[00]-[MFC dynamic Link Library makes a dialog window skin (i)]

Source: Internet
Author: User

Building a dynamic link library project based on MFC [Skindll]

"Step1 Resource Import" imports a bitmap resource that has been edited, defines the identifier, and sets the project to compile for the MFC static Library

#define IDB_LEFTTITLE 1000

#define IDB_MIDTITLE 1001

#define IDB_RIGHTTITLE 1002

#define Idb_leftband 1003

#define Idb_bottomband 1004

#define Idb_rightband 1005

#define Idb_minbutton 1006

#define Idb_maxbutton 1007

#define Idb_closebutton 1008

#define Idb_minhotbutton 1009

#define Idb_maxhotbutton 1010

#define Idb_closehotbutton 1011

#define IDB_LEFTBOTTOM 1012

#define IDB_RIGHTBOTTOM 1013

#define Idb_background 1014

The "Step2 Cfomrpart class" Cfomrpart class is used to describe the bitmap resource used by each part of the window and the relative position

Class cformpart{

Pulic:

Hbitmap M_hbitmap;

CPoint M_pos;

};

The implementation of the "Step3 Cskin class" Cskin class for the principal function

The member variables of the class have

UINT M_partcount; Number of window module splits

cformpart* M_pparts; Cformpart class pointers for each window module

COLORREF M_menubkcolor; Menu background Color

COLORREF M_menuselcolor; Menu selection Color

BOOL Drawroud; Whether to draw rounded corners

void Loadbitmapres (); Loading bitmap Resources

void Setbuttonpos (); Set the position of the window button

CSkin (); The constructor is used to initialize the data and call Loadbitmapres () to load the bitmap resource Setbuttonpos () to set the button location

~cskin ()//destructor

Virtual Hbitmap getbitmapres (UINT Index); Gets the specified bitmap resource

Virtual CPoint getbuttonpos (UINT Index); Gets the specified button position

Virtual COLORREF getmenubkcolor (); Get Menu Background color

Virtual COLORREF getmenuselcolor (); Gets the color of the menu selection

To export a class in a dynamic connection library, if you want the method in that class to be accessed, the method must be defined as a virtual function to be exported for access

"STEP4 Export Cskin class in DEF file"

[00002]-[2015-06-27]-[00]-[MFC dynamic Link Library makes a dialog window skin (i)]

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.