Ver Mensaje Individual
  #7  
Antiguo 29-02-2008
byfali byfali is offline
Miembro
 
Registrado: mar 2007
Posts: 24
Reputación: 0
byfali Va por buen camino
La verdad es que nunca e usado DrawGrid. Haber como me las avio para dibujar todos los datos que necesito mostrar.

Os muestro lo que llevo echo para que le echeis un vistazo. De momento solo es el esqueleto.

Solo hay que incluir un StringGrid y un boton.

implementation
{$R *.dfm}
function Min(i,j: Integer): Integer;
begin
if i < j then
Result:= i
else
Result:= j;
end;
procedure TForm15.Button1Click(Sender: TObject);
var
Buffer: array[1..16] of Byte;
F: File;
Leidos: Integer;
i,c,x: Integer;
Offset: Cardinal;
L:String;
begin
i:=0;
c:=0;
OpenDialog1.Execute;
AssignFile(F,OpenDialog1.FileName);
Filemode:= 0;
{$I-}
Reset(F,1);
{$I+}
if IOResult = 0 then
begin
Offset:= 0;
while not Eof(F) do
begin
//**********************
StringGrid1.Cells[i,c]:=IntToHex(Offset,8);
BlockRead(F,Buffer,16,Leidos);
//**************************
//********************************
for i:= 1 to Min(Leidos,8) do
StringGrid1.Cells[i,c]:=IntToHex(Buffer[i],2);
//***********************************
//**********************************
for i:= 9 to Min(Leidos,16) do
StringGrid1.cells[i,c]:=IntToHex(Buffer[i],2);
//***********************************
//***********************************
for i:= Min(Leidos,16) + 1 to 16 do
StringGrid1.Cells[i,c]:=#32;
for x:= 1 to Min(Leidos,16) do
if Char(Buffer[x]) in ['A'..'Z','a'..'z','0'..'9'] then
StringGrid1.Cells[i+x,c]:= Char(Buffer[x])
else
StringGrid1.Cells[i,c]:='.';
StringGrid1.Cells[i,c]:='|';
inc(Offset,Leidos);
inc(c);
i:=0;
// Va aumentado las filas segun lo necesite.
StringGrid1.RowCount:=StringGrid1.RowCount+1;
end;
CloseFile(F);
i:=0;
end;
end;

procedure TForm15.FormCreate(Sender: TObject);
begin
StringGrid1.ColCount:=34;
StringGrid1.DefaultColWidth:=15;
StringGrid1.DefaultRowHeight:=15;
StringGrid1.FixedCols:=0;
StringGrid1.FixedRows:=0;
StringGrid1.ColWidths[0]:=50;
end;
Responder Con Cita