Professional UI Solutions
Site Map   /  Register
 
 

Forum

Please Log In to post a new message or reply to an existing one. If you are not registered, please register.

NOTE: Some forums may be read-only if you are not currently subscribed to our technical support services.

Forums » Prof-UIS General Discussion » How to apply color to CExtGridWnd background in area not covered by data row Collapse All
Subject Author Date
Vitali Bounine May 26, 2006 - 7:00 PM

The area between the last inner row and bottom outer row (footer).

Technical Support May 28, 2006 - 12:42 PM

You can draw any grid background in a CExtGridWnd-derived class by overriding the CExtGridWnd::OnGbwEraseArea() virtual method. If the dwAreaFlags parameter is set to __EGBWA_INNER_CELLS, the rcArea specifies the entire inner data cell area. Of course, you should detect whether you have any vertical space between the last row and rcArea.bottom. You can use the following code to get the last visible row and the bottom margin:

CExtGridWnd * pGrid = ...
       if( pGrid->RowCountGet() == 0 || pGrid->ColumnCountGet() == 0 )
             return ...
CRect rcVisibleRange = pGrid->OnSiwGetVisibleRange();
CRect rcCellAtBottom;
       if( ! pGrid->GridCellRectsGet( rcVisibleRange.left, rcVisibleRange.bottom, 0, 0, NULL, &rcCellAtBottom ) )
             return ...
Now you can detect the area you need:
       If( rcCellAtBottom.bottom >= rcArea.bottom ) // nowhere to paint
             return ...
CRect rcAreaYouNeed( rcArea.left, rcCellAtBottom.bottom, rcArea.right, rcArea.bottom );