Professional User Interface Suite, Copyright FOSS Software Inc. Help Published with Permission.

By default, the horizontal and vertical scroll bars of the CExtGridWnd class are painted as regular Windows scroll bars. You can make them consistent with the currently used paint manager by following these simple steps:

1) Override GetScrollBarCtrl() method in a CExtExtGridWnd-derived class:

virtual CScrollBar * GetScrollBarCtrl( int nBar ) const
{
ASSERT_VALID( this );
if( m_hWnd == NULL || (! ::IsWindow(m_hWnd) ) )
return NULL;
ASSERT( nBar == SB_HORZ || nBar == SB_VERT );
if( nBar == SB_HORZ )
{
if( m_wndScrollBarH.GetSafeHwnd() != NULL )
return ( const_cast < CExtScrollBar * > ( &m_wndScrollBarH ) );
}
else
{
if( m_wndScrollBarV.GetSafeHwnd() != NULL )
return ( const_cast < CExtScrollBar * > ( &m_wndScrollBarV ) );
}
return NULL;
}

2) Declare two CExtScrollBar properties:

CExtScrollBar m_wndScrollBarH, m_wndScrollBarV;

3) Initialize the CExtScrollBar windows in the PreSubclassWindow() virtual method if your grid window is used as a custom dialog control or in the WM_CREATE message handler of the grid otherwise:

m_wndScrollBarH.m_eSO = CExtScrollBar::__ESO_BOTTOM;
m_wndScrollBarV.m_eSO = CExtScrollBar::__ESO_RIGHT;
if( ! m_wndScrollBarV.Create(
WS_CHILD|WS_VISIBLE|SBS_VERT|SBS_RIGHTALIGN,
CRect(0,0,0,0),
this,
1
)
)
{
ASSERT( FALSE );
return;
}
if( ! m_wndScrollBarH.Create(
WS_CHILD|WS_VISIBLE|SBS_HORZ|SBS_BOTTOMALIGN,
CRect(0,0,0,0),
this,
2
)
)
{
ASSERT( FALSE );
return;
}
m_wndScrollBarH.SyncReservedSpace( &m_wndScrollBarV );
m_wndScrollBarV.SyncReservedSpace( &m_wndScrollBarH );
OnSwRecalcLayout( true );