1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
|
procedure TProduitsFrame.DBGrid1DrawColumnCell(Sender: TObject;
const Rect: TRect; DataCol: Integer; Column: TColumn; State: TGridDrawState);
var
s:string;
DTParams: DrawTextParams;
r : Trect;
begin
r := rect;
with DTParams do begin
cbSize := SizeOf(DrawTextParams);
iTabLength := 6;
iLeftMargin := 10;
iRightMargin := 10;
end;
with TDBGrid(Sender).canvas do
begin
brush.style:=bssolid;
font.assign(column.Font);
if gdSelected in state then
begin
brush.Color:= _DBGrid_ROW_SELECTED;
font.color:=Clwhite;
end
else
begin
font.color:= Column.Font.color;
if TDBGrid(Sender).dataSource.DataSet.RecNo mod 2 = 0 then
Brush.Color := clwhite
ELse
Brush.Color := _DBGrid_ROW_ALTERNATE;
end;
fillrect(rect);
brush.style:=bsclear;
s := column.Field.DisplayText;
if Column.Field.Index = 4 then
begin
case column.Field.AsInteger of
2 : dm.GridIcons.Draw(TDBGrid(Sender).canvas, rect.Left, rect.Top,0, true);
1 : dm.GridIcons.Draw(TDBGrid(Sender).canvas, rect.Left, rect.Top,1, true);
end;
end
else
begin
If s<> '' then
case column.Alignment of
tacenter: DrawTextEx(Handle, PChar(S), -1,
R, DT_CENTER + DT_VCENTER + DT_SINGLELINE + DT_END_ELLIPSIS,
@DTParams);
taleftjustify: DrawTextEx(Handle, PChar(S), -1,
R, DT_LEFT + DT_VCENTER + DT_SINGLELINE + DT_END_ELLIPSIS,
@DTParams);
tarightjustify: DrawTextEx(Handle, PChar(S), -1,
R, DT_RIGHT + DT_VCENTER + DT_SINGLELINE + DT_END_ELLIPSIS,
@DTParams);
end;
end;
end;
end; |
Partager