Partager via


CDockState Class

A serialized CObject class that loads, unloads, or clears the state of one or more docking control bars in persistent memory (a file).

class CDockState : public CObject

Remarks

The dock state includes the size and position of the bar and whether or not it is docked. When retrieving the stored dock state, CDockState checks the bar's position and, if the bar is not visible with the current screen settings, CDockState scales the bar's position so that it is visible. The main purpose of CDockState is to hold the entire state of a number of control bars and to allow that state to be saved and loaded either to the registry, the application's .INI file, or in binary form as part of a CArchive object's contents.

The bar can be any dockable control bar, including a toolbar, status bar, or dialog bar. CDockState objects are written and read to or from a file via a CArchive object.

CFrameWnd::GetDockState retrieves the state information of all the frame window's CControlBar objects and puts it into the CDockState object. You can then write the contents of the CDockState object to storage with Serialize or CDockState::SaveState. If you later want to restore the state of the control bars in the frame window, you can load the state with Serialize or CDockState::LoadState, then use CFrameWnd::SetDockState to apply the saved state to the frame window's control bars.

For more information on docking control bars, see the articles Control Bars, Toolbars: Docking and Floating, and Frame Windows.

Requirements

Header: afxadv.h

See Also

Reference

CObject Class

Hierarchy Chart

Other Resources

CDockState Members