Cchart Daily Lesson--happy started playing against 14th session Red Apricot, Win32 standard control Chartctrl siege

Source: Internet
Author: User

This lesson is stupid to continue to introduce the application of Chartctrl control in Duilib.

Please review the high four third lesson first.

The method of this lesson is similar to the one in this lesson, because the Chartctrl provides the new tool, so programming can have some simplification.

First, the XML file is exactly the same as the started playing against third lesson.

Second, the CPP file only has the CreateControl part modified, as follows. Of course, the previous Cchartwnd variable is not required.

Virtual ccontrolui* CreateControl (LPCTSTR pstrclassname)    {        if (_tcsicmp (Pstrclassname, _t ("Wnd")) = = 0)        {            Cwndui  *pui  = new Cwndui;                        HWND    hwnd  = CreateWindow (_t ("Chartctrl"), _t ("Win32"), Ws_visible | Ws_child | Bs_pushbutton, 0, 0, 0, 0, M_paintmanager.getpaintwindow (), NULL, NULL, NULL);            Pui->attach (hWnd);               Cchart *chart = Getchart (hWnd); chart->addpoint2d (1, 1); CHART->ADDPOINT2D (2, 2); CHART->ADDPOINT2D (3, 2); CHART->ADDPOINT2D (4, 1);            return PUI;        }        Return Null;return Windowimplbase::createcontrol (pstrclassname);    }

As you can see, a Chartctrl window is created directly using CreateWindow, and the third lesson of started playing against IS to create a button window and then glue a cchartwnd.

Effect.


and started playing against the third lesson!!

In terms of code, the two lessons are similar. What are the benefits of the method in this lesson?

Oh, this is a secret, the General people I do not tell him yo!

In fact, the benefit is that the method in this lesson can create multiple windows. In the Cchart version of the current implementation of the stupid, only one window handle can be attach, creating a second window, the attach will fail. Of course, started playing against the eighth lesson can also create multiple windows, but there is a need to write their own window functions, not this lesson so concise.


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Cchart Daily Lesson--happy started playing against 14th session Red Apricot, Win32 standard control Chartctrl siege

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.