Subject | RE: [IBO] Question about TIB_Grid.OnDrawCell |
---|---|
Author | Riho-Rene Ellermaa |
Post date | 2003-11-05T12:43:38Z |
THat is how I do it
//Colors grid rows according to statuses
void __fastcall TFMaster::GridGetCellProps(TObject *Sender, int ACol,
int ARow, TGridDrawState AState, TColor &AColor, TFont *AFont)
{
if ( !ACol || !ARow ) return;
if(DSource && DSource->Dataset && DSource->Dataset->Active)
{ int BufferRowNum = Grid->DataRow[ ARow ];
DSource->Dataset->BufferRowNum = BufferRowNum;
int stat = DSource->Dataset->BufferFieldByName("STATUS")->AsInteger;
if(stat==1)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Prepared",clBlack);
else if(stat==3)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Waiting2",clOlive);
else if(stat==2)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Accepted",clGreen);
else if(stat==4)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Rejected",clRed);
else if(stat==8)
AFont->Color = Common.IniFile->ReadInteger("Colors","Sent",clBlue);
else if(stat==16)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Archived",clTeal);
else
AFont->Color = clWindowText;
}
}
Riho Ellermaa
[Non-text portions of this message have been removed]
//Colors grid rows according to statuses
void __fastcall TFMaster::GridGetCellProps(TObject *Sender, int ACol,
int ARow, TGridDrawState AState, TColor &AColor, TFont *AFont)
{
if ( !ACol || !ARow ) return;
if(DSource && DSource->Dataset && DSource->Dataset->Active)
{ int BufferRowNum = Grid->DataRow[ ARow ];
DSource->Dataset->BufferRowNum = BufferRowNum;
int stat = DSource->Dataset->BufferFieldByName("STATUS")->AsInteger;
if(stat==1)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Prepared",clBlack);
else if(stat==3)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Waiting2",clOlive);
else if(stat==2)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Accepted",clGreen);
else if(stat==4)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Rejected",clRed);
else if(stat==8)
AFont->Color = Common.IniFile->ReadInteger("Colors","Sent",clBlue);
else if(stat==16)
AFont->Color =
Common.IniFile->ReadInteger("Colors","Archived",clTeal);
else
AFont->Color = clWindowText;
}
}
Riho Ellermaa
[Non-text portions of this message have been removed]