#include "ltwrappr.h"
virtual L_INT LDialogImage::DoModalCanvasResize(hWndOwner)
Displays the Canvas Resize dialog box.
Handle of the window which owns the dialog.
Value | Meaning |
---|---|
SUCCESS_DLG_OK | The "OK" button was pressed, and the dialog exited successfully. |
SUCCESS_DLG_CANCEL | The "Cancel" button was pressed, and the dialog exited successfully. |
< 1 | An error occurred. Refer to Return Codes. |
LDialogImage::SetCanvasResizeParams must be called before using this function to set the initial values for the dialog. You can get the updated CANVASRESIZEDLGPARAMS with the values entered by the user through the dialog by using LDialogImage::GetCanvasResizeParams.
The Canvas Resize dialog.
Required DLLs and Libraries
L_INT LDialogImage_DoModalCanvasResizeExample(LBitmap * pBitmap, HWND hWnd)
{
L_INT nRet;
LDialogImage DlgImage;
nRet = LDialogImage::Initialize(DLG_INIT_COLOR );
if(nRet != SUCCESS)
return nRet;
DlgImage.SetBitmap(pBitmap);
CANVASRESIZEDLGPARAMS DlgParams;
memset ( &DlgParams, 0, sizeof ( CANVASRESIZEDLGPARAMS ) ) ;
DlgParams.uStructSize = sizeof ( CANVASRESIZEDLGPARAMS ) ;
DlgParams.uDlgFlags = DLG_CANVASRESIZE_SHOW_CURRENT_HEIGHT |
DLG_CANVASRESIZE_SHOW_CURRENT_WIDTH |
DLG_CANVASRESIZE_SHOW_HORIZPOS |
DLG_CANVASRESIZE_SHOW_VERTZPOS |
DLG_CANVASRESIZE_SHOW_BACKCOLOR |
DLG_CANVASRESIZE_SHOW_KEEPASPECT ;
DlgParams.nCurrentWidth = pBitmap->GetWidth ();
DlgParams.nCurrentHeight = pBitmap->GetHeight ();
DlgParams.crBkgnd = RGB ( 255, 255, 255 ) ;
DlgImage.EnableCallBack (FALSE);
DlgImage.EnablePreview(TRUE);
DlgImage.EnableAutoProcess(TRUE);
DlgImage.EnableToolbar(TRUE);
nRet = DlgImage.SetCanvasResizeParams(&DlgParams) ;
if(nRet != SUCCESS)
return nRet;
nRet = DlgImage.DoModalCanvasResize(hWnd);
if(nRet < 1)
return nRet;
// Gets the updated values for the structure
nRet = DlgImage.GetCanvasResizeParams(&DlgParams, sizeof(DlgParams)) ;
if(nRet != SUCCESS)
return nRet;
nRet = LDialogImage::Free();
if(nRet != SUCCESS)
return nRet;
return SUCCESS;
}