Add skin to the application UI

Source: Internet
Author: User

Create a dialog box project with VC.

 

1. After # include <afxdisp. h> In stdafx. H, add the followingCode:

 

# Import "actskn43.ocx" no_implementation raw_interfaces_only raw_native_types
Using namespace activeskinlib;
# Include <atlbase. h>

 

 

2. Switch to resource view, right-click on the dialog box, click "insert ActiveX control", select activeskin 4.3 Control, and edit its ID.

 

3. In xxxdlg. H, add the member variable ccomqiptr <iskin> m_pskin to the class in the dialog box;

 

4. In xxxdlg. cpp, write the following code in the oninitdialog () function:

 

// Use the skin ID here

M_pskin = getdlgitem (idc_skin_play)-> getcontrolunknown ();

M_pskin-> applyskin (INT) m_hwnd );

Char chdirectory [500];
Getmodulefilename (null, (lpwch) chdirectory, 500 );
Cstring strpath (chdirectory );
// Set the path
Strpath = "./skin/untitled. skn ";
BSTR bstrskinfile = strpath. allocsysstring ();
 

// Load skin

M_pskin-> loadskin (bstrskinfile );
// Application skin here, the Control ID (idc_button_play) and the Object Name (BTN) of the skin are used)
M_pskin-> applyskinbyname (long) getdlgitem (idc_button_play)-> m_hwnd, l "btn1 ");

 

RunProgramThe control has a skin effect!

 

Related Article

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.