Print Page | Close Window

Using PNG with CXTButton?

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=4872
Printed Date: 18 June 2025 at 1:22pm
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Using PNG with CXTButton?
Posted By: loqqus
Subject: Using PNG with CXTButton?
Date Posted: 24 August 2006 at 4:40am
Is it possible to use a PNG with CXTButton instead of a bmp or ico? For example, in the Button Sample project, replace the bmps with pngs.

If so, which member fn should I call, or do I need to convert the png to bmp?



Replies:
Posted By: Oleg
Date Posted: 24 August 2006 at 8:54am
Hi,
 
Add Png file ro resources, load it
 
 BOOL bAlphaBitmap = FALSE;
HBITMAP hBitmap = CXTPImageManagerIcon::LoadBitmapFromResource(MAKEINTRESOURCE(nID), &bAlphaBitmap);
 
CXTPImageManagerIconHandle hIconHandle;
hIconHandle = hBitmap;  // Will call DeleteObject;
and call
btn.SetIcon(size, hIconHandle, CXTPImageManagerIconHandle(), TRUE);
 
 
 


-------------
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS


Posted By: loqqus
Date Posted: 25 August 2006 at 12:18am
Perfect! Works great -- Many thanks!


Posted By: Hmbucker
Date Posted: 12 October 2012 at 4:00am
That shows the png alright, but it looses the skinning of the button???
So I guess the only possible solution is to derive a button call CButton::OnPaint(); and then draw your own png right?
A bit a pity though, as I would expect such an expensive tool to do that for me...



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