![]() | Type | Description | ||
| Color | A color expression that indicates the control's foreground color. |
The following VB sample sets the foreground color for the first column:
With Grid1.Columns(0)
.Def(exCellForeColor) = RGB(255, 0, 0)
End WithThe following C++ sample sets the foreground color for the first column:
#include "Column.h" #include "Columns.h" CColumns columns = m_grid.GetColumns(); CColumn column = columns.GetItem( COleVariant( long(0) ) ); column.SetDef(5, COleVariant( (long)RGB(255,0,0 ) ) );
The following VB.NET sample sets the foreground color for the first column:
With AxGrid1.Columns(0)
.Def(EXGRIDLib.DefColumnEnum.exCellForeColor) = ToUInt32(Color.FromArgb(255, 0, 0))
End Withwhere the ToUInt32 function converts a Color expression to OLE_COLOR expression:
Shared Function ToUInt32(ByVal c As Color) As UInt32
Dim i As Long
i = c.R
i = i + 256 * c.G
i = i + 256 * 256 * c.B
ToUInt32 = Convert.ToUInt32(i)
End FunctionThe following C# sample sets the foreground color for the first column:
axGrid1.Columns[0].set_Def(EXGRIDLib.DefColumnEnum.exCellForeColor, ToUInt32(Color.FromArgb(255, 0, 0)));
where the ToUInt32 function converts a Color expression to OLE_COLOR expression:
private UInt32 ToUInt32(Color c)
{
long i;
i = c.R;
i = i + 256 * c.G;
i = i + 256 * 256 * c.B;
return Convert.ToUInt32(i);
}The following VFP sample sets the foreground color for the first column:
with thisform.Grid1.Columns(0) .Def(5) = RGB(255,0,0) endwith