Advertisement
TLama

Untitled

Nov 22nd, 2014
556
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.83 KB | None | 0 0
  1. procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect; DataCol: Integer;
  2.   Column: TColumn; State: TGridDrawState);
  3. var
  4.   Grid: TDBGrid;
  5.   Field: TField;
  6. begin
  7.   Grid := Sender as TDBGrid;
  8.   Field := Column.Field;
  9.  
  10.   if Assigned(Field) then
  11.   begin
  12.     if SameText(Field.FieldName, 'Clubs') then
  13.     begin
  14.       if SameText(Field.AsString, 'Yes') then
  15.         Grid.Canvas.Brush.Color := clRed
  16.       else
  17.         Grid.Canvas.Brush.Color := clYellow;
  18.     end
  19.     else
  20.     if SameText(Field.FieldName, 'Netice') then
  21.     begin
  22.       case UpCase(Field.AsString[1]) of
  23.         'D': Grid.Canvas.Brush.Color := clRed;
  24.         'L': Grid.Canvas.Brush.Color := clgreen;
  25.         'W': Grid.Canvas.Brush.Color := clYellow;
  26.       end;
  27.     end;
  28.   end;
  29.   Grid.DefaultDrawColumnCell(Rect, DataCol, Column, State);
  30. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement