SetSrcRect example for Delphi
This example zooms in on the image by reducing the source rectangle and repaints the image.
procedure TForm1.Button3Click(Sender: TObject);
var
NewLeft, NewTop, NewWidth, NewHeight: Integer;
begin
NewLeft := Lead1.SrcLeft+ Round(Lead1.SrcWidth * 0.1);
NewTop := Lead1.SrcTop + Round(Lead1.SrcHeight * 0.1);
NewWidth := Round(Lead1.SrcWidth * 0.8);
NewHeight := Round(Lead1.SrcHeight * 0.8);
If (NewWidth > 1) AND (NewHeight >1) Then
Lead1.SetSrcRect(NewLeft, NewTop, NewWidth, NewHeight);
Lead1.ForceRepaint;
end;