Trim example for Delphi

This example trims one-tenth from the bitmap and repaints the image.

var
NewLeft, NewTop, NewWidth, NewHeight: Integer;

begin
NewLeft := Lead1.BitmapWidth div 10;
NewTop := Lead1.BitmapHeight div 10;
NewWidth := (Lead1.BitmapWidth * 8) div 10;
NewHeight := (Lead1.BitmapHeight * 8) div 10;
Lead1.Trim(NewLeft, NewTop, NewWidth, NewHeight);

{ Set the image display size to match the LEAD control}
Lead1.SetDstRect(0, 0, Lead1.BitmapWidth, Lead1.BitmapHeight);
Lead1.SetDstClipRect(0, 0, Lead1.BitmapWidth, Lead1.BitmapHeight);
Lead1.ForceRepaint;

end;