共用方式為


CDocObjectServer::OnApplyViewState

Override this function to restore the state of the DocObject view.

virtual void OnApplyViewState( 
   CArchive& ar  
);

Parameters

  • ar
    A CArchive object from which to serialize the view state.

Remarks

This function is called when the view is being displayed for the first time after its instantiation. OnApplyViewState instructs a view to reinitialize itself according to the data in the CArchive object previously saved with OnSaveViewState. The view must validate the data in the CArchive object because the container does not attempt to interpret the view state data in any way.

You can use OnSaveViewState to store persistent information specific to your view's state. If you override OnSaveViewState to store information, you will want to override OnApplyViewState to read that information and apply it to your view when it is newly activated.

Requirements

Header: afxdocob.h

See Also

Reference

CDocObjectServer Class

Hierarchy Chart

CDocObjectServer::OnSaveViewState