Implement label control for folder styles in Excel and Visual C + + (i)

Source: Internet
Author: User

As we all know, a workbook in Excel can have more than one work form (worksheet), and each form can be controlled flexibly by a label in the lower left corner (see figure I), and Visual C + + has similar controls, such as setting in the Output window: Build,debug, Find in files and results, such as Label control (figure II).

Figure one Label control in Excel

Figure II Label control in Visual C + +

We refer to this interface as the label control of the folder style, hereinafter referred to as the label control, and in MFC, the tab control is called the label controls. So how is the label control implemented? Are there any out-of-the-box controls available in MFC?

Many people in the forum have raised this question. After reading this article, I think this question should have a satisfactory answer. MFC is very convenient for programming, but it can not replace the programmer's programming, MFC just provides a programming framework, the application of the substantive code or must be written by the programmer. At the same time, MFC's problem is also obvious, that is, its GUI material is too rich, so that programmers are too dependent on MFC, when you want to implement the GUI features of MFC does not feel overwhelmed.

Let's take a look at how to implement the Label control interface for the folder styles shown in Figure I and figure two. One might think of starting with the ready-made Label controls (tab control). But experience has shown that this approach is not to be used for convenience and better reusability. I'm a big fan of reusability, but we don't do enough in our code. So I'd rather create a window class myself, and there's a benefit that you can completely control the changes in your code without having to take into account the huge impact and hassle of your own code as a result of the changes in the existing control version. I think the guy at Microsoft would have wanted you to do the same. If you use Spy + + to view the interface between Excel and Visual C + +, you will find that the label control of its folder style is not systabcontrol32s, but a separate window class created. Why don't we also create one?

Please look at the picture shown in figure three, this is a program I wrote Fldrtab, it implements the interface function we want. The C + + class that implements this UI is created by myself, it's called Cfoldertabctrl.

Figure three Fldrtab program running picture

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.