I might have misunderstood what you are trying to do, but should it be:
Rect.left:=trunc(x/6)*6;
Rect.right:=rect.left+6;
Rect.top:=trunc(y/6)*6;
Rect.bottom:=rect.top+6;
> Jeremy Coulter wrote:
>
> Hi all.
>
> I need a little guidence here.
>
> I have a image control that I have draw a grid onto.
> The grids are 6x pixels, and it is 72 "Cells" wide and 14 high.
> What I want to do is, when I click on the left mouse button in one of the "Cells" I
>want to find the rect of that "Cell" do I can fill the rect.
> I have had a go, but with no real success.
>
> i.e. . Rect.left:= x-trunc(x / 6);
> Rect.right:=rect.left+6;
> Rect.top:=y-trunc(y / 6);
> Rect.bottom:=Rect.top+6;
> but its not right.
>
> Can someone help me here by suggesting if not providing a better way ??
>
> cheers,
>
> Jeremy Coulter
--
John Mason
Sinclair Knight Merz Limited
---------------------------------------------------------------------------
New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
Website: http://www.delphi.org.nz
To UnSub, send email to: [EMAIL PROTECTED]
with body of "unsubscribe delphi"