Available in the LEADTOOLS Imaging toolkit. |
ShowGradientDlg Example for C++ 5.0 and later
void CDialogs::OnShowGradientDlg() { HRESULT hr; int nRet; ILEADRasterDlgKrn_U *m_pRasterDlgKrn = NULL; hr = CoCreateInstance(CLSID_LEADRasterDlgKrn_U, NULL, CLSCTX_ALL, IID_ILEADRasterDlgKrn_U, (LPVOID*)&m_pRasterDlgKrn); ILEADRasterDlgEfx_U *m_pRasterDlgEfx = NULL; hr = CoCreateInstance(CLSID_LEADRasterDlgEfx_U, NULL, CLSCTX_ALL, IID_ILEADRasterDlgEfx_U, (LPVOID*)&m_pRasterDlgEfx); nRet = m_pRasterDlgKrn->InitDlg(INIT_WITH_COLOR); m_pRasterDlgEfx->Gradient->StartColor = RGB(0, 0, 255); m_pRasterDlgEfx->Gradient->EndColor = RGB(255, 0, 0); m_pRasterDlgEfx->Gradient->GradientStyle = EFX_GRADIENT_ANGLE_TO_RT; m_pRasterDlgEfx->Gradient->Steps= 200; m_pRasterDlgEfx->UIFlags = GRADIENT_SHOW_PREVIEW | GRADIENT_AUTOPREVIEW | GRADIENT_STARTCOLOR | GRADIENT_ENDCOLOR | GRADIENT_STEPS | GRADIENT_NO_TREEVIEW | GRADIENT_CLASS_LINEAR | GRADIENT_CLASS_ANGULAR | GRADIENT_CLASS_RECTANGULAR | GRADIENT_CLASS_ELLIPTICAL | GRADIENT_CLASS_CONICAL; m_pRasterDlgEfx->Bitmap = m_pLead1.GetBitmap(); nRet = m_pRasterDlgEfx->ShowGradientDlg((long)m_hWnd); if (nRet == 0 && m_pRasterDlgEfx->DialogStatus == DLG_OK) { CString csRes; csRes.Format(TEXT("GradientStyle: %d\nGradientSteps: %d\nStartColor: %ld\nEndColor: %ld\n"), m_pRasterDlgEfx->Gradient->GradientStyle, m_pRasterDlgEfx->Gradient->Steps, m_pRasterDlgEfx->Gradient->StartColor, m_pRasterDlgEfx->Gradient->EndColor); AfxMessageBox(csRes); } }