Gracias por tu ayuda Jhonny, respondiendo a la pregunta a qui va las partes del código
Variables generales
Código Delphi
[-]var
Form1: TForm1;
footer:tstatusbar;
fin, Colfin,colini: integer;
El OnCreate del Form
Código Delphi
[-]
procedure TForm1.FormCreate(Sender: TObject);
var footer:tstatusbar;
i:integer;
begin
footer:=TStatusBar.Create(self);
footer.Parent:=DBGrid1;
footer.Top:=DBGrid1.Height;
footer.Left:=DBGrid1.Left;
footer.Width:=dbgrid1.Width;
footer.Panels.Add;
footer.Panels.Items[0].Width:=11;
for I := 1 to DBGrid1.Columns.Count-1 do
begin
footer.Panels.Add;
footer.Panels.Items[i].Width:=DBGrid1.Columns.Items[i-1].Width+2;
end;
fin:=0;
colfin:=0;
end;
Y El DrawColumnCell
Código Delphi
[-]procedure TForm1.DBGrid1DrawColumnCell(Sender: TObject; const Rect: TRect;
DataCol: Integer; Column: TColumn; State: TGridDrawState);
var i:integer;
begin
if fin=0 then
begin
fin:=1;
colini:=Column.ID;
end;
if column.id>Colfin then colfin:=Column.ID;
if (DBGrid1.DataSource.DataSet.RecNo=DBGrid1.DataSource.DataSet.RecordCount)
and
(Column.ID=colfin) then begin
for I := 0 to footer.Panels.Count -1 do begin
if (i>=(colini))and(i<=(Colfin)) then
begin
footer.Panels.Items[i].Width:=DBGrid1.Columns.Items[i].Width;
footer.Panels.Items[i].Text:=IntToStr(Column.ID);
end else Footer.Panels.Items[i].Width:=0;
end;
fin:=0;
end;
end;