Re:OnDrawColumnCell
procedure TFeesAndDiscountsForm.sgDrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var
TWidth : Integer;
begin
with sgDFQ.canvas do
begin
if ARow = 0 then
begin
SetTextAlign(Handle, TA_Center);
sgDFQ.Canvas.Font.Style := [fsBold];
sgDFQ.Canvas.Font.Color := clNavy;
FillRect(Rect);
TWidth := TextWidth(sgDFQ.cells[ACol, ARow]);
TextRect(Rect, Rect.RIGHT - Twidth, Rect.Top+1, sgDFQ.Cells[ACol,
ARow])
end
else
begin
if (gdFocused in State) then
begin
sgDFQ.Canvas.Brush.Color := clNavy;
sgDFQ.Canvas.Font.Color := clWhite;
end
else
begin
sgDFQ.Canvas.Font.Color := clBlack;
sgDFQ.Canvas.Font.Style := [];
end;
SetTextAlign(Handle, TA_RIGHT);
FillRect(Rect);
TextRect(Rect, Rect.RIGHT-2, Rect.Top+1, sgDFQ.Cells[ACol, ARow])
end;
end;
end;
--
Thanks in Advance
Ant
Quote
"David Biebel" <com...@erols.com> wrote in message
news:3B8E7663.3CA1C2E8@erols.com...
Quote
> I have a DBGrid descendant component. I may or may not need to indent
> the text that appears in the cells within the first column based on a
> value contained in another field. So if the other field contains a
> certain value, then I need the Description column being displayed within
> the grid to be indented a certain number of spaces within the cell.
> Can someone assist me with a starting point?
> For example, if the Level field = 5, then I want the Description value
> to be indented 5 spaces within the cell for that particular record. Is
> the OnDrawColumnCell the place where I need to be? And how do I allow
> Default drawing for all of the other columns? Any code snippet samples
> would be greatly appreciated.