Another example:
// Draw "thirds" within the selection box
procedure TForm1.ImageEnView1DrawCanvas(Sender: TObject; ACanvas: TCanvas; ARect: TRect);
var
selRect: TIERectangle;
{}
procedure _DrawLine(x1, y1, x2, y2: Integer); // bmp values
begin
ACanvas.Pen.Color := clGray;
ACanvas.MoveTo( ImageEnView1.XBmp2Scr( x1 ), ImageEnView1.YBmp2Scr( y1 ) );
ACanvas.LineTo( ImageEnView1.XBmp2Scr( x2 ), ImageEnView1.YBmp2Scr( y2 ) );
end;
{}
begin
if not ( ImageEnView1.Selected and chkDrawBox.Checked ) then
exit;
selRect := ImageEnView1.SelectedRect;
// Horz Thirds
_DrawLine( selRect.x, selRect.y + MulDiv( selRect.height, 1, 3 ),
selRect.x + selRect.Width, selRect.y + MulDiv( selRect.height, 1, 3 ) );
_DrawLine( selRect.x, selRect.y + MulDiv( selRect.height, 2, 3 ),
selRect.x + selRect.Width, selRect.y + MulDiv( selRect.height, 2, 3 ) );
// Vert Thirds
_DrawLine( selRect.x + MulDiv( selRect.Width, 1, 3 ), selRect.y,
selRect.x + MulDiv( selRect.Width, 1, 3 ), selRect.y + selRect.height );
_DrawLine( selRect.x + MulDiv( selRect.Width, 2, 3 ), selRect.y,
selRect.x + MulDiv( selRect.Width, 2, 3 ), selRect.y + selRect.height );
end;
Nigel
Xequte Software
www.imageen.com