Bueno a lo que habia llegado hasta el momento es:
Código Delphi
[-]
unit UfrmCaptura;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, Grids, ComCtrls, TeEngine, ExtCtrls, TeeProcs, Chart;
type
TfrmCaptura = class(TForm)
StringGrid1: TStringGrid;
procedure FormCreate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
private
procedure InicializaStringGrid;
public
end;
var
frmCaptura: TfrmCaptura;
implementation
{$R *.dfm}
procedure TfrmCaptura.FormCreate(Sender: TObject);
begin
InicializaStringGrid;
end;
procedure TfrmCaptura.FormShow(Sender: TObject);
begin
Stringgrid1.cells[1,2] := '12.000';
StringGrid1.Cells[2,2]:= '50,000.00';
end;
procedure TfrmCaptura.InicializaStringGrid ;
var
r,a,p: integer;
begin
with StringGrid1 do
begin
Top := 8;
Left := 8;
Height := 279;
Width := 246;
ColCount := 3;
RowCount:= 29;
fixedRows := 2;
fixedCols := 1;
Cells[0,1] := 'Hora';
ColWidths[0] := 80;
Cells[1,1] := 'Operaciones';
ColWidths[1] := 70;
Cells[2,1] := 'Acumulado';
ColWidths[2] := 70;
end;
for r := 0 to 26 do
begin
case r of
0 : begin
a := 6;
p := a + 1;
StringGrid1.Cells[0,(r + StringGrid1.FixedRows )] := IntToStr(a)+ ':00' +
' - ' +
IntToStr(p) + ':00';
end;
8,17,26 : StringGrid1.Cells[0,(r + StringGrid1.FixedRows )] := 'Resumen';
20 : begin
a := 0;
p := a + 1;
StringGrid1.Cells[0,(r + StringGrid1.FixedRows )] := IntToStr(a)+ ':00' +
' - ' +
IntToStr(p) + ':00';
end ;
else
begin
a := p;
p := p + 1;
StringGrid1.Cells[0,(r + StringGrid1.FixedRows )] := IntToStr(a)+ ':00' +
' - ' +
IntToStr(p) + ':00';
end;
end;
end;
end;
procedure TfrmCaptura.StringGrid1DrawCell(Sender: TObject; ACol,
ARow: Integer; Rect: TRect; State: TGridDrawState);
var sCad: String;
i: Integer;
begin
If (ACol=1) Or (ACol=2) Then
if ARow > 1 then If StringGrid1.Cells[ACol,ARow] <> '' Then
Begin
sCad := StringGrid1.Cells[ACol,ARow];
With StringGrid1 Do
with Canvas,Rect do
Begin
Canvas.Brush.Style := bsSolid;
case ACol of
1: Canvas.Brush.Color := clYellow;
2: Canvas.Brush.Color := clRed;
end;
i:=Right-TextWidth(sCad+' ');
Canvas.FillRect(Rect);
Canvas.TextOut(i,Top+2,sCad);
End;
End;
end;
end.
No pongo el archivo pues uso d2010 y parece ser que no es posible abrirlo con versiones anteriores. El formulario es un simple form con un StringGrid. El codigo de la Unit le da tamaño y posicion.
Editando: Caral como puedes ver para la columna horario estoy usando la propiedad FixedRows, tu ejemplo me dio otras ideas.
Contraveneno la verdad no me caen muy bien las jedi, ya d2010 se tarda años en arrancar y todavia cargar la JVCL..... De todos modos no hecho en saco roto tu propuesta.