<< Return to Main Index

< Return to Class Index

CGXStyle:: SetIncludeNegativeStateColor

CGXStyle& SetIncludeNegativeStateColor (BOOL b);

b

TRUE if NegativeStateColor should be marked as initialized; FALSE otherwise.

Return Value

Returns the this pointer.

Remarks

Specifies the include state for the NegativeStateColor property.

If you fill the grid in "virtual mode" then setting this attribute will not work.

For virtual mode, you should set this attribute in the style in your GetSTyleRowCol, ComposeStyleRowCol or OnLoadCellStyle override, after you supply the data.

Example

void CMyGrid::ComposeStyleRowCol(ROWCOL nRow, ROWCOL nCol, CGXStyle* pStyle, BOOL bApplyStandard)
{
   <Call your base class and supply data (if appropriate)>
   .......
   if(!(IsCurrentCell(nRow, nCol) && pStyle->GetIncludeControl() && GetRegisteredControl(pStyle->GetControl())->IsActive()))
   {
      if(pStyle->GetIncludeValue()
         && pStyle->GetIncludeNegativeStateColor()
         && _gxttof(pStyle->GetValue()) < 0 
         )
      {
         DWORD csColor ;
         csColor = pStyle->GetNegativeStateColor();
         pStyle->SetTextColor(csColor);
      }
   }
}

CGXStyle

Class Overview | Class Members