Print Page | Close Window

CXTPImageManagerIcon::DrawAlphaBitmap() wont work

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Toolkit Pro
Forum Description: Topics Related to Codejock Toolkit Pro
URL: http://forum.codejock.com/forum_posts.asp?TID=17737
Printed Date: 19 June 2025 at 1:30pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: CXTPImageManagerIcon::DrawAlphaBitmap() wont work
Posted By: tomay3000
Subject: CXTPImageManagerIcon::DrawAlphaBitmap() wont work
Date Posted: 30 December 2010 at 5:01pm
CXTPImageManagerIcon::DrawAlphaBitmap() wont work on OnDraw() virtual function Views !?

void CGLVAgenceView::OnInitialUpdate()
{
    m_pSet = &GetDocument()->m_gLVAgenceSet;
    CRecordView::OnInitialUpdate();
    GetParentFrame()->RecalcLayout();
    ResizeParentToFit();

    HRSRC hResource = ::FindResource(NULL, MAKEINTRESOURCE(IDR_PNG1), _T("PNG"));
    CXTPGraphicBitmapPng bmpPNG;

    if (!bmpPNG.LoadFromResource(NULL, hResource))
    {
        TRACE0("Failed to load PNG from resource\n");
        return;      // fail load PNG from resource
    }
    if (!m_bmp.Attach(CXTPImageManagerIcon::PreMultiplyAlphaBitmap(bmpPNG)))
    {
        TRACE0("Failed to attach bmp\n");
        return;      // fail to attach bmp
        bmpPNG.DeleteObject();
    }
}


void CGLVAgenceView::OnDraw(CDC* pDC) 
{
    // TODO: Add your specialized code here and/or call the base class

    CXTPImageManagerIcon::DrawAlphaBitmap(pDC, m_bmp, CPoint(7, 7), CSize(48, 48));
}


Where:
private:
    CBitmap m_bmp;

is previously declared.

And my CGLVAgenceView is a CRecordView derived class.

I tested the same code on an CDialog OnPaint() message map function & it's working perfectly.

Any idea ? Confused



-------------
Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit)

Language: Microsoft Visual C++ v6.0 (MFC)



Replies:
Posted By: tomay3000
Date Posted: 31 December 2010 at 4:51pm
I found the origin of the problem: It was that the PNG image I was using as resource has wrong PNG structure (I corrected it using GIMP).

-------------
Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit)

Language: Microsoft Visual C++ v6.0 (MFC)



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net