|
|
|
|
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.
Subject |
Author |
Date |
|
Offer Har
|
Mar 3, 2009 - 2:59 PM
|
Dear Support, I have a grid which I override OnSiwPaintBackground and paint it in the dialog’s color:
void CMyGrid::OnSiwPaintBackground(CDC & dc,bool bFocusedControl) const
{
ASSERT_VALID( this );
CExtGridWnd::OnSiwPaintBackground( dc, bFocusedControl );
CRect rcGridInner = OnSwGetClientRect();
if( ! dc.RectVisible( &rcGridInner ) )
return;
bool bFillArea = true;
if( g_PaintManager->GetCb2DbTransparentMode( (CWnd*)this ) )
{
if( g_PaintManager->PaintDockerBkgnd( true, dc, (CWnd*)this ) )
bFillArea = false;
} // if( g_PaintManager->GetCb2DbTransparentMode( (CWnd*)this ) )
if( bFillArea )
{
COLORREF clrFill =
g_PaintManager->GetColor( CExtPaintManager::CLR_3DFACE_OUT, (CObject*)this );
dc.FillSolidRect( &rcGridInner, clrFill );
} // if( bFillArea )
} All works fine, until I set one of the check-boxes cells I have to disabled like this:
pCell->ModifyStyle(__EGCS_READ_ONLY); After this call, the background of the disabled cell returns to being white, which is not what I want. Is this a bug? if not, what do I need to do so that the bakc color of this cell will not change when it’s read-only? Thanks, Ron.
|
|
Technical Support
|
Mar 4, 2009 - 12:48 PM
|
You can invoke the CExtGridCell::TextColorSet() method for all your grid cells when you inserting them into the grid window. You should use the CExtGridCell::__ECS_READ_ONLY color type to change only the read-only text color of your grid cells. This is the first solution. The second solution is to implement the CExtGridCell::OnQueryTextColor() virtual method in your grid cell classes. The third and the most convenient solution is to implement the CExtGridWnd::OnGridCellQueryTextColor() virtual method in your grid control class. The CExtGridWnd::OnGridCellQueryTextColor() virtual method can return the COLORREF(-1L) value if you want the grid cell to compute its text color using default color selection algorithm. This virtual method should analyze whether the grid cell has the __EGCS_READ_ONLY cell style and return the desired text color for it.
|
|
Offer Har
|
Mar 4, 2009 - 7:08 PM
|
I don’t understand why it works for normal cell, the background is painted with color function of CMyGrid::OnSiwPaintBackground , but when the cell is disabled it does not - why can’t I tell the cell to not paint its back-color in the same way it does not do it if the cell is not read-only?
|
|
Technical Support
|
Mar 5, 2009 - 8:00 AM
|
Please implement the CExtScrollItemWnd::OnSiwGetReadOnlyBackgroundColor() virtual method and return the COLORREF(-1L) value from it.
|
|
Offer Har
|
Mar 5, 2009 - 11:01 AM
|
Thanks, Problem solved...
|
|