I have a CIconCheckBox class which is
derived from CXTPButton class. This function for setting ImageManager:
void CIconCheckBox::SetImageManager(CXTPImageManager*
pImageManager)
{
if (pImageManager
&& m_pMarkupContext)
{
m_pMarkupContext->SetImageManager(pImageManager);
CMDTARGET_ADDREF(pImageManager);
}
else
ASSERT(0);
}
This checkbox is then initialized in a dialog
as follow
CMyDialog::OnInitDialog()
{
BOOL result =
CXTPPropertyPage::OnInitDialog();
// m_imageManager &
m_checkbox are members of CMyDialog
m_imageManager.SetImageList(IDB_IMAGELIST, 16);
m_checkbox.SubclassDlgItem(IDC_CHECKBOXID,
this);
m_checkbox.SetImageManager(&m_imageManager);
m_checkbox.SetImage(0);
}
This code works well in v16.2.4 &
Visual Studio 2012. However, after being upgraded to v17.3.0 & Visual
Studio 2015, exception always occurs in CXTPImageManagerIconHandle::GetBitmap()
because of hBitmap=null and m_pRInfo=null.
HBITMAP
CXTPImageManagerIconHandle::GetBitmap() const
{
ASSERT(IsAlpha());
if (m_hBitmap)
return
m_hBitmap;
if (m_pRInfo &&
m_pRInfo->pResource && m_pRInfo->pResource->m_hbmpImage)
return
m_pRInfo->pResource->m_hbmpImage;
ASSERT(FALSE);
return NULL;
}
// Call
Stack for reference
ToolkitPro1730vc140UD.dll!CXTPImageManagerIconHandle::GetBitmap()
Line 1320 C++
ToolkitPro1730vc140UD.dll!CXTPMarkupGdiPlusDeviceContext::IconToGdiplusBitmap(CXTPImageManagerIcon
* pIcon) Line 781 C++
ToolkitPro1730vc140UD.dll!CXTPMarkupGdiPlusDeviceContext::DrawImage(CXTPImageManagerIcon
* pIcon, CRect rc) Line 799 C++
ToolkitPro1730vc140UD.dll!CXTPMarkupGdiPlusDeviceContext::DrawImage(CXTPMarkupDeviceDependentImage
* pImage, CRect rc) Line
872
C++
ToolkitPro1730vc140UD.dll!CXTPMarkupDrawingContext::DrawImage(CXTPMarkupDeviceDependentImage
* pImage, CRect rc) Line 845
C++
ToolkitPro1730vc140UD.dll!CXTPMarkupImage::OnRender(CXTPMarkupDrawingContext
* pDC) Line 230 C++
ToolkitPro1730vc140UD.dll!CXTPMarkupVisual::Render(CXTPMarkupDrawingContext
* drawingContext) Line 878
C++
ToolkitPro1730vc140UD.dll!CXTPMarkupVisual::Render(CXTPMarkupDrawingContext
* drawingContext) Line
884
C++
ToolkitPro1730vc140UD.dll!XTPMarkupRenderElement(CXTPMarkupUIElement
* pElement, HDC__ * hDC, const tagRECT * lpRect) Line 131 C++
ToolkitPro1730vc140UD.dll!CXTPButtonTheme::DrawButtonText(CDC
* pDC, CXTPButton * pButton) Line 418 C++
ToolkitPro1730vc140UD.dll!CXTPButtonTheme::DrawButton(CDC
* pDC, CXTPButton * pButton) Line
119 C++
ToolkitPro1730vc140UD.dll!CXTPButton::DoDraw(CDC
* pDC) Line
396
C++
ToolkitPro1730vc140UD.dll!CXTPButton::OnDraw(CDC
* pDC) Line
382
C++
ToolkitPro1730vc140UD.dll!CXTPButton::OnPaint()
Line
349
C++
|