Hi Siva!

Here is an example from the Delphi Help for creating a selection:

procedure TForm1.Button1Click(Sender: TObject);
var
  myRect: TGridRect;
begin
  myRect.Left := 2;    //Left Column number
  myRect.Top := 1;     //Top Row number
  myRect.Right := 3;   //Right column number
  myRect.Bottom := 4;  //Bottom Row number
  DrawGrid1.Selection := myRect;
End;

You can then use a For loop to access the cells.  For example:

procedure TForm1.ButtonLoadGridClick(Sender: TObject);
Var
C, R, X : Integer;
myRect: TGridRect; //Used for holding the Grid selection coordinates
begin
X := 1;
MyRect := DrawGrid1.Selection;         //Get Coordinates
For C := MyRect.Left to myRect.Right do //Columns
For R := myRect.Top to myRect.Bottom do //Rows
Begin
DrawGrid1.Cells[C,R] := IntToStr(X);    //Load Cells
Inc(X);
end;

Hope this is what you are looking for.

Tom Nesler


-----Original Message-----
From: delphi-en@yahoogroups.com [mailto:delphi...@yahoogroups.com] On Behalf Of 
siva subramanian

thanks for your reply.Can u send me sample code for it.Its very usefull for me.
Thanks & Regards
Siva



Reply via email to