SetSrcRect example for C++ Builder

This example zooms in on the image by reducing the source rectangle and repaints the image.

void __fastcall TForm1::Button1Click(TObject *Sender)
{
   int NewLeft, NewTop, NewWidth, NewHeight;
   NewLeft = Lead1->SrcLeft+ Lead1->SrcWidth / 10;
   NewTop = Lead1->SrcTop + Lead1->SrcHeight / 10;
   NewWidth = Lead1->SrcWidth * 8 / 10;
   NewHeight = Lead1->SrcHeight * 8 / 10;
   if( (NewWidth > 1) && (NewHeight >1))
      Lead1->SetSrcRect(NewLeft, NewTop, NewWidth, NewHeight);
   Lead1->ForceRepaint();
}