Adding a directory tree to the VC-like interface implementation

Source: Internet
Author: User

Objective

This article is in the "Easy VC interface" on the basis of writing, the first time to write articles, table righteousness unclear, please understand! If the book belongs to the story, start ...

The results of the program are as follows: the left and the bottom have two floating, variable size control windows, in the Left tab page, you can display the system directory.

First, the realization principle

The implementation class for the two windows in the figure is derived from CControlBar, and Mr. Wang Jun the Csizingcontrolbar class and named Ccoolbar, and all I have to do is apply that class. The tree in the left window is derived from the class Cdirtreectrl, as long as we refer to the code.

Second, the application of the example

1, the establishment of an SDI based project, the project named: 009. (In my project, the name is basically 008,007)

2, the folder Splitclass under the Sizecbar.h sizecbar.cpp scbarg.h

Scbarg.cpp four files are copied to the engineering directory. In the menu Project->add to project->files add four files to the project, a class called Ccoolbar will appear in ClassView.

In the StdAfx.h file, add

#include "sizecbar.h"
#include "scbarg.h"

2.1. Add member variable for CMainFrame:

CCoolBar m_LeftCtrBar; //左面的控制窗口
CCoolBar m_BottomCtrBar; //最下面的控制窗口

2.2. Add the following code in int cmainframe::oncreate (lpcreatestruct lpcreatestruct):

//-----------1.创建ControlBar--------
if(!(m_LeftCtrBar.Create(_T("我的控制条1"), this, CSize(230,260),TRUE, 123)))
{
  TRACE0("Failed to create m_LeftCtrBar\n");
  return -1;
}
if(!(m_BottomCtrBar.Create(_T("我的控制条2"), this, CSize(100, 100), TRUE, 124)))
{
  TRACE0("Failed to cretae m_BottomCtrBar\n");
  return -1;
}   

2.3, Docking control:

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.