Hola ermac.
Hay muchas variantes para lo que buscas hacer, te pongo un ejemplo simple pero bastante flexible :
Código Delphi
[-]
procedure WCOnlyNumber(WC: TWinControl);
begin
SetWindowLong(WC.Handle, GWL_STYLE,
GetWindowLong(WC.Handle, GWL_STYLE) + ES_NUMBER);
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
WCOnlyNumber(edColDes); WCOnlyNumber(edColHas); WCOnlyNumber(edFilaDes); WCOnlyNumber(edFilaHas); end;
procedure RellenaGrid(SG: TStringGrid; const cDes, fDes, cHas, fHas: Integer;
const Character: Char);
var
f, c: Integer;
begin
if (cDes < 0)or(fDes < 0)or(cHas >= SG.ColCount)or(fHas >= SG.RowCount) or
(cDes > cHas) or (fDes > fHas) then
raise Exception.Create('Error en rango');
for c:= cDes to cHas do
for f:= fDes to fHas do
SG.Cells[c,f] := Character;
end;
procedure TForm1.btnRellenaClick(Sender: TObject);
begin
RellenaGrid(StringGrid1, StrToInt(edColDes.Text), StrToInt(edFilaDes.Text),
StrToInt(edColHas.Text), StrToInt(edFilaHas.Text), '>')
end;
Saludos