VC + + window split CSplitterWnd

Source: Internet
Author: User

Objective

Many of today's best software uses "multi-vision" technology.

The so-called "multi-vision" refers to the same frame window to display multiple views simultaneously.

By using this technique, we can provide the user with more information in the limited control of the frame, and make the user interface more friendly, and enhance the operability of the software.

Split type

MFC supports two types of splitter windows: static and dynamic.

  static splitter window : The number of rows is set when the splitter window is created, and the user cannot change, but the user can scale the columns of each row. A static splitter window can contain up to 16 rows of 16 columns. To find an application that uses a static splitter window, just look at the Windows Manager.

  dynamic splitter Windows : You can have up to two rows of two columns, but they can be split and merged with each other. VC uses a dynamic splitter window to enable simultaneous editing of more than two different parts of the source program files.

One criterion for choosing a static or dynamic split is whether you want users to be able to interactively modify the row and column configurations of a splitter window. Another determinant is the kind of view that you plan to use in the splitter window.

CSplitterWnd class

The CSplitterWnd class primarily provides encapsulation for window partitioning, which is managed by the objects of the class when the window is divided into panes.

  

Interactions between multi-view classes

In an MFC program, the data interaction between the various view classes is done through the Doc class, which is processed by the CDocument class and displayed by the CView class. The data is stored in the CDocument class, and the data is then read from that class.

Lock Slice Bar

When a user creates a split window, it is sometimes not desirable to resize the window by dragging the slice bar. In this case, you must lock the slitting bar. The simplest way to lock a slicing bar is to not let the CSplitterWnd handle the wm_lbuttondown,wm_mousemove,wm_setcursor message, but rather to pass the messages to the CWnd window for processing, thereby masking the messages.

Customization of slitting Strips

The slicing bar generated by window itself is always fixed, and there is no change, but we can find that when we use some software, such as ACDSee, they are not the same as the automatically generated slicing strips. So how do you customize your own slitting strips? By overloading the virtual methods of CSplitterWnd Ondrawsplitter and Oninverttracker can achieve this purpose.

A more complete example: HTTP://PAN.BAIDU.COM/S/1GE39INH

VC + + window split CSplitterWnd

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.