|| | |||Browse by category|
How do I change the styles for cells when using a browser grid? SetStyleRange() doesn't appear to be working?
You can change the appearance of individual columns with
You might also format groups of cells by changing their base style.
But, you can't change the formatting of individual cells with SetStyleRange(). If you want to outline individual cells you need to override OnLoadCellStyle()
See "Outlining the row or column of the current cell with special formatting?".
The reason for this behavior is that if the grid would allow you to apply formatting with SetStyleRange(), they would be bound directly to the cell. But, what happens if there would have been rows inserted in the recordset, if the filter changes or if you do a requery? Most times, when you want to format cells in a DAO or ODBC Grid, it is because you want to outline depending on their context. And for outlining a cell on its context, overriding OnLoadCellStyle() and supply the cells formatting at runtime is the only way.
By the way, this behavior is also controlled through the CGXBrowseParam::m_bCanStoreGridCellInCGXData attribute. Take a look at the description of the CGXBrowseParam class.