cxysplit_C++
所属分类:Windows编程
开发工具:Visual C++
文件大小:21KB
下载次数:8
上传日期:2005-05-08 20:28:13
上 传 者:
xcx08032
说明: 这是一个用C++编写的可以在DialogBox中使用的切分类库。(21KB)
(It is a class library for DialogBox spliting using C++.)
文件列表:
MySplit.clw (1695, 1998-06-15)
MySplit.cpp (2044, 1998-06-13)
MySplit.dsp (4337, 1998-06-15)
MySplit.dsw (537, 1998-06-13)
MySplit.h (1343, 1998-06-13)
MySplit.rc (6020, 1998-06-15)
MySplitDlg.cpp (5619, 1998-06-13)
MySplitDlg.h (1589, 1998-06-13)
Release\MySplit.exe (15872, 1998-06-15)
Resource.h (915, 1998-06-13)
res\MySplit.ico (1078, 1998-06-13)
res\MySplit.rc2 (399, 1998-06-13)
StdAfx.cpp (205, 1998-06-13)
StdAfx.h (928, 1998-06-13)
xySplitterWnd.cpp (12622, 1998-06-15)
xySplitterWnd.h (2961, 1998-06-13)
This article was contributed by Maq (maquan@yahoo.com).
Many programmers are interesting in splitter that using
in dialogbox, so do I.
When I read the article General Purpose Splitter Class
written by Yurong Lin, I got an idea to make my own classes.
Anyway, Lin's splitter is very good and easy to use, but
it has some limitation, such as: 1) do not support more
than one pane on one side of the splitter; 2) do not support
vertical split; 3) no dragging restriction. Fortunately,
it is not very hard to add these features.
Here is the project I'v made, it contains two classes:
CxSplitterWnd & CySplitterWnd, to use them, follow the
steps below:
1. Create an picture control in the dialog resource, this
control will act as a splitter afterward. Set the type
as Frame, move it to the appropriate position, then give
it an ID, such as IDC_XBAR1. One picture control for one
splitter, you can make any number of splitters as you like.
In fact, you can use any kind of control instead of picture
control, but the picture control is better.
2. Declare the objects of CxSplitterWnd/CySplitterWnd in
your dialog class, of course, you should include
xySplitterWnd.h first.
CxSplitterWnd m_xSplitter1, m_xSplitter2;
CySplitterWnd m_ySplitter;
3. Setup the splitter objects in the InitDialog function.
m_xSplitter1.BindWithControl(this, IDC_XBAR1); // bind the splitter object to the puppet control
m_xSplitter1.SetMinWidth(10, 50); // set the minimum width of the left/right pane
m_xSplitter1.AttachAsRightPane(IDC_LEFTPANE1); // attach a control within the same dialogbox as a pane of the splitter
m_xSplitter1.AttachAsRightPane(IDC_YBAR); // you can even attach another splitter as a pane
m_xSplitter1.AttachAsRightPane(IDC_LEFTPANE2);
m_xSplitter1.RecalcLayout();
4. Un-bind the splitter object with the puppet control when
dialogbox went to close. This step can be omitted when
you do not want to re-use the splitter object.
m_xSplitter1.Unbind();
Just as Lin's work, there is a message "WM_SPLITTER_MOVED"
is generated by the splitter bar whenever the splitter is
dragged then dropped. If you want to do something special
when the splitter is repositioned, then provide a message
handler for this message.
近期下载者:
相关文件:
收藏者: