A dialog box class that supports skinning

Source: Internet
Author: User
Tags bool transparent color

First, introduce

This class inherits from MFC's CDialog and supports the following characteristics:

1, run on the Win2000 or WinXP platform, you can use any transparent color to the perspective of the dialog box area.

2, running on the Win2000 or WinXP platform, you can make the entire dialog transparent.

3, use the bitmap background. Bitmaps can come from resource files, BMP, or Hbitmap

4, set the background type: Title, center, telescopic; The size of the dialog box fits the size of the bitmap

5, you can click on any part of the dialog box to allow/Prohibit the Mobile dialog box

Second, use

This class is used in the following ways:

1, to the project to add documents CDIALOGSK.H and CDialog.cpp

2, in your dialog box class contains CDialogSD.h

3, in your dialog box class with Cdialogsk instead of all the CDialog

4, if you want to use the background picture, find the dialog box properties of the Type option, so that style=popup,

Border=none and makes the title bar an optional state.

5, at the end of the OnInitDialog of your dialog class, add the call to the Cdialogsk property method:

BOOL CSkinDialog_DemoDlg::OnInitDialog()
   EnableEasyMove();            // 允许移动
   SetBitmap (IDB_BACKGROUND);       //设置背景位图
   SetStyle (LO_RESIZE);          // 使对话框大小适合位图大小
   SetTransparentColor(RGB(0, 255, 0));  //设置透明色为绿色
return TRUE;

6. For example, if you want to generate a circular dialog box, you can create a picture with a green background and a blue circle. Then, call SetBitmap, the parameter is the path to the image, call SetTransparentColor, and the parameter is the background color (green). This will not see the background, to get a circular window.

Third, the method

The Cdialogsk class provides the following methods:

1, DWORD SetBitmap (Hbitmap hbitmap);

2, DWORD setbitmap (int nbitmap);

3, DWORD SetBitmap (LPCTSTR lpszfilename);

4, void SetStyle (Layoutstyle style);

Lo_default, Lo_tile (title picture), Lo_center (center picture), Lo_stretch (telescopic picture to fit the dialog box size), or lo_resize (Telescopic dialog box for picture).

5, void Enableeasymove (BOOL penable = TRUE);

6, BOOL settransparent (BYTE balpha);

Makes the entire dialog transparent, with a range of 0 (transparent)-255 (opaque). Only suitable for Win2000 and above versions

7, BOOL SetTransparentColor (COLORREF col, bool Btrans = TRUE);

Specifies a transparent color. Only suitable for Win2000 and above versions.

Cdialogsk class file download address Http://www.codeguru.com/code/legacy/dialog/CDialogSK_src.zip

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.