Available in the LEADTOOLS Imaging toolkit. |
ShowResizeDlg Example for C++ 5.0 and later
void CDialogs::OnShowResizeDlg() { HRESULT hr; int nRet; ILEADRasterDlgKrn_U *m_pRasterDlgKrn = NULL; hr = CoCreateInstance(CLSID_LEADRasterDlgKrn_U, NULL, CLSCTX_ALL, IID_ILEADRasterDlgKrn_U, (LPVOID*)&m_pRasterDlgKrn); ILEADRasterDlgImg_U *m_pRasterDlgImg = NULL; hr = CoCreateInstance(CLSID_LEADRasterDlgImg_U, NULL, CLSCTX_ALL, IID_ILEADRasterDlgImg_U, (LPVOID*)&m_pRasterDlgImg); nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR); m_pRasterDlgImg->MaxNewWidth = 0; m_pRasterDlgImg->MaxNewHeight = 0; m_pRasterDlgImg->MaxNewResolutionX = 0; m_pRasterDlgImg->MaxNewResolutionY = 0; m_pRasterDlgImg->CurrentWidth = m_pLead1.GetBitmapWidth(); m_pRasterDlgImg->CurrentHeight = m_pLead1.GetBitmapHeight(); m_pRasterDlgImg->CurrentResolutionX = m_pLead1.GetBitmapXRes(); m_pRasterDlgImg->CurrentResolutionY = m_pLead1.GetBitmapYRes(); m_pRasterDlgImg->BitsPerPixel = m_pLead1.GetBitmapBits(); m_pRasterDlgImg->UIFlags = RESIZE_SHOW_IDENTICALVALUE | RESIZE_SHOW_MAINTAINASPECT | RESIZE_SHOW_PERCENTAGE; m_pRasterDlgImg->Bitmap = m_pLead1.GetBitmap(); nRet = m_pRasterDlgImg->ShowResizeDlg((long)m_hWnd); if (nRet == 0 && m_pRasterDlgImg->DialogStatus == DLG_OK) { m_pLead1.Size(m_pRasterDlgImg->NewWidth, m_pRasterDlgImg->NewHeight, m_pRasterDlgImg->GetResizeFlags()); } }