M
MFCProgrmmer
Guest
The following code, for loading a bitmap into a CPictureCtrl, works in a CDialogEx but not in a CFormView
void CMyFormView::SetPNGResource(UINT nRes, UINT CtrlID)
{
LPSTREAM pStrmDefImg = UTILS_PTR->TurnStream(MAKEINTRESOURCE(nRes),_T("PNG"));
if(pStrmDefImg != NULL) {
CImage img;
img.Load(pStrmDefImg);
CPictureCtrl* pCtrl = (CPictureCtrl*)GetDlgItem(CtrlID);
pCtrl->ModifyStyle(0, SS_BITMAP);
pCtrl->SetBitmap(img);
pStrmDefImg->Release();
}
}
After pCtrl->SetBitmap call the the pCtr->m_bIsPicLoaded=1 in case of CDialogEx and 0 in case of CFormView and bitmap is not displayed in the form.
How is loading bitmap in CPictureCtrl different in CDialogEx and CFormView?
MFCPROGRMER
Continue reading...
void CMyFormView::SetPNGResource(UINT nRes, UINT CtrlID)
{
LPSTREAM pStrmDefImg = UTILS_PTR->TurnStream(MAKEINTRESOURCE(nRes),_T("PNG"));
if(pStrmDefImg != NULL) {
CImage img;
img.Load(pStrmDefImg);
CPictureCtrl* pCtrl = (CPictureCtrl*)GetDlgItem(CtrlID);
pCtrl->ModifyStyle(0, SS_BITMAP);
pCtrl->SetBitmap(img);
pStrmDefImg->Release();
}
}
After pCtrl->SetBitmap call the the pCtr->m_bIsPicLoaded=1 in case of CDialogEx and 0 in case of CFormView and bitmap is not displayed in the form.
How is loading bitmap in CPictureCtrl different in CDialogEx and CFormView?
MFCPROGRMER
Continue reading...