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: