Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - CXTPImageManagerIcon::DrawAlphaBitmap() wont work
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

CXTPImageManagerIcon::DrawAlphaBitmap() wont work

 Post Reply Post Reply
Author
Message
tomay3000 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2010
Location: Algeria
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomay3000 Quote  Post ReplyReply Direct Link To This Post Topic: CXTPImageManagerIcon::DrawAlphaBitmap() wont work
    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)
Back to Top
tomay3000 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2010
Location: Algeria
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomay3000 Quote  Post ReplyReply Direct Link To This Post 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)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.031 seconds.