A Font button class (WTL)

Source: Internet
Author: User

This article is going to introduce two things: one is a very useful cdialogresize template class in WTL, allowing you to drag the dialog box to resize (including the control automatically adapts to the dialog box), and the other is a subclass of button buttons that produce a three-dimensional font ( An example of this site is to use MFC to do the Cmytextbutton class, I transplanted it into the WTL, encapsulated into the Cfontbutton class, here first thanks to the author of this code, but can only display English fonts. With these examples, you can see that there is nothing mystical about WTL.

A Use of the Cdialogresize class

1. Add public cdialogresize<cderive> to the base class column inherited by the dialog box

In this case, add

public CDialogResize<CMainDlg>

2. Add macros

BEGIN_DLGRESIZE_MAP(CDialogResize<>)
       DLGRESIZE_CONTROL(id, flags)
END_DLGRESIZE_MAP()

Specifies that the control needs this support, where the ID is the value of the control Id,flags as follows:

dlsz_size_x = 0x00000001,

Dlsz_size_y = 0x00000002,

dlsz_move_x = 0x00000004,

Dlsz_move_y = 0x00000008,

Dlsz_repaint = 0x00000010.

3. Add Dlgresize_init () in OnInitDialog (), OK

In the atlframe.h you can find the definition of dlgresize_init (), and some people used MFC to write similar code, if you are interested to compare.

Finally, do not forget to add the corresponding header file in the stdafx.h, see the source file specifically.

Two Implementation of Cfontbutton Class

1. Cownerdraw and Ccustomdraw

Both template classes support the custom drawing feature, and the difference between them is Ccustomdraw processing nm_customdraw, which generally supports header,

List view, rebar, toolbar, ToolTip, TrackBar, and tree view control redraw; Cownerdraw processing Wm_drawitem, Wm_measureitem, Wm_compareitem and WM _deleteitem these four messages, usually support button, combo box, list box, List View control, and menu items

's self painting.

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.