ShowCanvasResizeDlg example for C++ Builder

void __fastcall TForm1::ShowCanvasResizeDlg1Click(TObject *Sender) 
{
   L_INT nRet; 

   LEADDlgImage1->CurrentWidth = LEADImage1->BitmapWidth; 
   LEADDlgImage1->CurrentHeight = LEADImage1->BitmapHeight; 
   LEADDlgImage1->BackgroundColor = RGB ( 255, 255, 255 ); 

   LEADDlgImage1->DlgFlags = DLG_CANVASRESIZE_SHOW_CURRENT_HEIGHT |
                           DLG_CANVASRESIZE_SHOW_CURRENT_WIDTH  |
                           DLG_CANVASRESIZE_SHOW_HORIZPOS       |
                           DLG_CANVASRESIZE_SHOW_VIRTZPOS       |
                           DLG_CANVASRESIZE_SHOW_BACKCOLOR      |
                           DLG_CANVASRESIZE_SHOW_KEEPASPECT; 

   LEADDlgImage1->LEADImage = LEADImage1; 
   LEADDlgImage1->LEADDlgService = LEADDlgService1; 

   nRet= LEADDlgImage1->ShowCanvasResizeDlg ( this ); 
   if ( nRet == SUCCESS_DLG_OK ) 
   {
      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 | CB_DST_1 ); 

      LEADImage1->Bitmap= LEADImage2->Bitmap; 
   }
}