共用方式為


CSplitterWnd Class

Provides the functionality of a splitter window, which is a window that contains multiple panes.

class CSplitterWnd : public CWnd

Members

Public Constructors

Name

Description

CSplitterWnd::CSplitterWnd

Call to construct a CSplitterWnd object.

Public Methods

Name

Description

CSplitterWnd::ActivateNext

Performs the Next Pane or Previous Pane command.

CSplitterWnd::CanActivateNext

Checks to see if the Next Pane or Previous Pane command is currently possible.

CSplitterWnd::Create

Call to create a dynamic splitter window and attach it to the CSplitterWnd object.

CSplitterWnd::CreateScrollBarCtrl

Creates a shared scroll bar control.

CSplitterWnd::CreateStatic

Call to create a static splitter window and attach it to the CSplitterWnd object.

CSplitterWnd::CreateView

Call to create a pane in a splitter window.

CSplitterWnd::DeleteColumn

Deletes a column from the splitter window.

CSplitterWnd::DeleteRow

Deletes a row from the splitter window.

CSplitterWnd::DeleteView

Deletes a view from the splitter window.

CSplitterWnd::DoKeyboardSplit

Performs the keyboard split command, usually "Window Split."

CSplitterWnd::DoScroll

Performs synchronized scrolling of split windows.

CSplitterWnd::DoScrollBy

Scrolls split windows by a given number of pixels.

CSplitterWnd::GetActivePane

Determines the active pane from the focus or active view in the frame.

CSplitterWnd::GetColumnCount

Returns the current pane column count.

CSplitterWnd::GetColumnInfo

Returns information on the specified column.

CSplitterWnd::GetPane

Returns the pane at the specified row and column.

CSplitterWnd::GetRowCount

Returns the current pane row count.

CSplitterWnd::GetRowInfo

Returns information on the specified row.

CSplitterWnd::GetScrollStyle

Returns the shared scroll-bar style.

CSplitterWnd::IdFromRowCol

Returns the child window ID of the pane at the specified row and column.

CSplitterWnd::IsChildPane

Call to determine whether the window is currently a child pane of this splitter window.

CSplitterWnd::IsTracking

Determines if splitter bar is currently being moved.

CSplitterWnd::RecalcLayout

Call to redisplay the splitter window after adjusting row or column size.

CSplitterWnd::SetActivePane

Sets a pane to be the active one in the frame.

CSplitterWnd::SetColumnInfo

Call to set the specified column information.

CSplitterWnd::SetRowInfo

Call to set the specified row information.

CSplitterWnd::SetScrollStyle

Specifies the new scroll-bar style for the splitter window's shared scroll-bar support.

CSplitterWnd::SplitColumn

Indicates where a frame window splits vertically.

CSplitterWnd::SplitRow

Indicates where a frame window splits horizontally.

Protected Methods

Name

Description

CSplitterWnd::OnDraw

Called by the framework to draw the splitter window.

CSplitterWnd::OnDrawSplitter

Renders an image of a split window.

CSplitterWnd::OnInvertTracker

Renders the image of a split window to be the same size and shape as the frame window.

Remarks

A pane is usually an application-specific object derived from CView, but it can be any CWnd object that has the appropriate child window ID.

A CSplitterWnd object is usually embedded in a parent CFrameWnd or CMDIChildWnd object. Create a CSplitterWnd object using the following steps:

  1. Embed a CSplitterWnd member variable in the parent frame.

  2. Override the parent frame's CFrameWnd::OnCreateClient member function.

  3. From within the overridden OnCreateClient, call the Create or CreateStatic member function of CSplitterWnd.

Call the Create member function to create a dynamic splitter window. A dynamic splitter window typically is used to create and scroll a number of individual panes, or views, of the same document. The framework automatically creates an initial pane for the splitter; then the framework creates, resizes, and disposes of additional panes as the user operates the splitter window's controls.

When you call Create, you specify a minimum row height and column width that determine when the panes are too small to be fully displayed. After you call Create, you can adjust these minimums by calling the SetColumnInfo and SetRowInfo member functions.

Also use the SetColumnInfo and SetRowInfo member functions to set an "ideal" width for a column and "ideal" height for a row. When the framework displays a splitter window, it first displays the parent frame, then the splitter window. The framework then lays out the panes in columns and rows according to their ideal dimensions, working from the upper-left to the lower-right corner of the splitter window's client area.

All panes in a dynamic splitter window must be of the same class. Familiar applications that support dynamic splitter windows include Microsoft Word and Microsoft Excel.

Use the CreateStatic member function to create a static splitter window. The user can change only the size of the panes in a static splitter window, not their number or order.

You must specifically create all the static splitter's panes when you create the static splitter. Make sure you create all the panes before the parent frame's OnCreateClient member function returns, or the framework will not display the window correctly.

The CreateStatic member function automatically initializes a static splitter with a minimum row height and column width of 0. After you call Create, adjust these minimums by calling the SetColumnInfo and SetRowInfo member functions. Also use SetColumnInfo and SetRowInfo after you call CreateStatic to indicate desired ideal pane dimensions.

The individual panes of a static splitter often belong to different classes. For examples of static splitter windows, see the graphics editor and the Windows File Manager.

A splitter window supports special scroll bars (apart from the scroll bars that panes may have). These scroll bars are children of the CSplitterWnd object and are shared with the panes.

You create these special scroll bars when you create the splitter window. For example, a CSplitterWnd that has one row, two columns, and the WS_VSCROLL style will display a vertical scroll bar that is shared by the two panes. When the user moves the scroll bar, WM_VSCROLL messages are sent to both panes. When the panes set the scroll-bar position, the shared scroll bar is set.

For further information on splitter windows, see:

  • Technical Note 29

  • Knowledge Base article Q262024: HOWTO: Use CPropertySheet as a Child of CSplitterWnd

For more information on how to create dynamic splitter windows, see:

Inheritance Hierarchy

CObject

CCmdTarget

CWnd

CSplitterWnd

Requirements

Header: afxext.h

See Also

Reference

CWnd Class

Hierarchy Chart

CView Class

CWnd Class

Concepts

MFC Sample VIEWEX