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 Tech Support » The questions about CExtGridCell Collapse All
Subject Author Date
Zhang KaiFeng Dec 8, 2005 - 6:11 PM

1、I use the method   BackColorSet(CExtGridCell::e_cell_state_t eCellState,COLORREF clr = COLORREF( -1L ))  to change the color of thhe gridcell,when the first parameter is set to CExtGridCell::__ECS_ALL,it’s ok。But when the first parameter is set to the others ,there is a error when the program is running!The following is my code:


CExtGCC<CExtGridCellString> ;


CExtGridCellString * pCellString = STATIC_DOWNCAST(
    
      CExtGridCellString,
      GridCellGet
      (0L,nRowNo,0,0,RUNTIME_CLASS(CExtGridCellString)));


pCellString->BackColorSet(CExtGridCell::__ECS_ALL,RGB(221,230,230));//it’s ok!!


pCellString->BackColorSet(CExtGridCell::__ECS_SELECTED,RGB(221,230,230));//it’s not ok!!

Technical Support Dec 9, 2005 - 9:50 AM

First of all, you don’t need to apply the CExtGCC template decorator to the CExtGridCellString class. It is derived from CExtGridCellEx, which already applies this template to CExtGridCell:

CExtGridCellString : public CExtGridCellEx
CExtGridCellEx : public CExtGCC < CExtGridCell >
Then, do not associate colors with the CExtGridCell::__ECS_SELECTED and CExtGridCell::__ECS_ALL modes simultaneously because, if you set colors to all the cell modes, other colors are ignored. Please take a look at the CExtGridCell::OnQueryBackColor() method so you can see how we select the appropriate color:
COLORREF clrBackAll = BackColorGet( __ECS_ALL );
COLORREF clrBackNormal = BackColorGet( __ECS_NORMAL );
COLORREF clrBackSelected = BackColorGet( __ECS_SELECTED );
COLORREF clrBackHovered = BackColorGet( __ECS_HOVERED );
 
 if( clrBackAll != COLORREF(-1L) )
  return clrBackAll;
 
...