CGXGridCore::SetScrollBarMode

virtual void SetScrollBarMode(int nBar, int nSetting, BOOL bRedraw = TRUE);

nBar

Specifies the scrollbar. It can be SB_VERT for the vertical scrollbar, SB_HORZ for the horizontal scrollbar, or SB_BOTH for both scrollbars.

nSetting

Specifies the scrollbar-state. Specifies the state of the scrollbars: gxnEnabled for always visible, gxnDisabled for hidden, gxnShared for shared scrollbars. gxnAutomatic is used to enable scrollbars if required. You can combine this setting with an OR-operator with gxnEnhanced. If gxnEnhanced is set, scrollbars will have the enhanced scrollbar look&feel, and the grid will always try to display as many cells as possible in the window and automatically scroll if necessary (gxnEnhanced is set by default).

bRedraw

Specifies if the new scrollbar state should be made visible immediately.

Remarks

Call this function to initialize the scrollbars.

If you use the grid in a workbook or splitter window, both scrollbars should be set to gxnShared. OnGridInitialUpdate determines if the parent window is a workbook or splitter window and sets the scrollbars to either gxnShared or gxnAutomatic if it is a normal frame window.

If you use the grid as user control in a dialog template, the default settings for scrollbars are determined through the style-bits in the user control’s property-dialog in Visual Studio. If you use the grid as child control with two-phase construction, you can pass the style-bits to the Create method. CGXGridWnd::Initialize calls SetScrollBarMode and sets the vertical scrollbar to gxnAutomatic when the WS_VSCROLL style has been set, and the vertical scrollbar when the WS_HSCROLL has been set. If WS_VSCROLL or WS_HSCROLL is not specified, the corresponding scrollbar is set gxnDisabled.

Note: Don’t call SetScrollBarMode before calling CGXGridWnd::Initialize,because CGXGridWnd::Initialize overrides the scrollbar settings.

See Also

 CGXGridCore::OnGridInitialUpdate  CGXGridWnd::Initialize

CGXGridCore

 Class Overview |  Class Members