ShowCanvasResizeDlg example for Delphi

procedure TForm1.ShowCanvasResizeDlg1Click(Sender: TObject); 
var
   nRet: L_INT; 
begin

   LEADDlgImage1.CurrentWidth:= LEADImage1.BitmapWidth; 
   LEADDlgImage1.CurrentHeight:= LEADImage1.BitmapHeight; 
   LEADDlgImage1.BackgroundColor:= RGB ( 255, 255, 255 ); 
   LEADDlgImage1.DlgFlags:= DLG_CANVASRESIZE_SHOW_CURRENT_HEIGHT Or
                            DLG_CANVASRESIZE_SHOW_CURRENT_WIDTH  Or
                            DLG_CANVASRESIZE_SHOW_HORIZPOS       Or
                            DLG_CANVASRESIZE_SHOW_VIRTZPOS       Or
                            DLG_CANVASRESIZE_SHOW_BACKCOLOR      Or
                            DLG_CANVASRESIZE_SHOW_KEEPASPECT; 
                               
   LEADDlgImage1.LEADImage:= LEADImage1; 
   LEADDlgImage1.LEADDlgService:= LEADDlgService1; 

   nRet:= LEADDlgImage1.ShowCanvasResizeDlg ( Self ); 
   if ( nRet = SUCCESS_DLG_OK ) then
   begin
      LEADImage2.CreateBitmap ( LEADDlgImage1.NewWidth
                                LEADDlgImage1.NewHeight
                                LEADImage1.BitmapBits ); 

      LEADImage2.Combine ( LEADDlgImage1.TopLeftPoint.X, 
                           LEADDlgImage1.TopLeftPoint.Y, 
                           LEADImage1.BitmapWidth, 
                           LEADImage1.BitmapHeight, 
                           LEADImage1.Bitmap, 
                           0, 
                           0, 
                           CB_OP_AND Or CB_DST_1 ); 

      LEADImage1.Bitmap:= LEADImage2.Bitmap; 
   end; 
end;