![]() |
|
|
#1
|
|||
|
|||
|
Схожу с ума... Пытаюсь в DBGrid-е окрасить строки в которых поле ost меньше нуля...
Код:
procedure TForm1.G_tovDrawDataCell(Sender: TObject; const Rect: TRect;
Field: TField; State: TGridDrawState);
begin
if d.Tovar.FieldByName('ost').AsFloat < 0 then
G_tov.Canvas.font.Color := clRed;
G_tov.DefaultDrawDataCell(Rect, Field, State);
end;все просто... все соответствует exampl-ам... и НЕ РАБОТАЕТ Кто знает что за глюк? И как с ним бороться? Последний раз редактировалось Admin, 20.08.2009 в 21:53. |
|
#2
|
||||
|
||||
|
примерно так:
Код:
procedure TeForm.GridDrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
begin
if ((Grid.DataSource.DataSet.FieldByName('Icrtf_vers_typ').AsString='DB') AND
(not Grid.DataSource.DataSet.FieldByName('Icrtf_id').IsNull) AND
(not Grid.DataSource.DataSet.FieldByName('Icrtf_form_series').IsNull) AND
(not Grid.DataSource.DataSet.FieldByName('Icrtf_form_num').IsNull)) then
begin
with Grid.Canvas do
begin
Brush.Color:=$008000;
Font.Color:=$FFFFFF;
FillRect(Rect);
TextOut(Rect.Left+2,Rect.Top+2,Column.Field.Text);
end;
end;
end; |