-
December 15th, 2013, 05:00 PM
#1
Use bitmap on button instead of text
Hi everyone,
I'm trying to create a dialog where some of the buttons have pictures on them, rather than plain text.
Is it possible to do that?
I notice that under the button's properties, under the "styles" tab there's a checkbox "bitmap".
I've been googling for a bit now, but I can't seem to find any easy way of setting a bitmap.
Thank you in advance.
-
December 15th, 2013, 05:47 PM
#2
Re: Use bitmap on button instead of text
Originally Posted by rmirani
Hi everyone,
I'm trying to create a dialog where some of the buttons have pictures on them, rather than plain text.
Is it possible to do that?
I notice that under the button's properties, under the "styles" tab there's a checkbox "bitmap".
I've been googling for a bit now, but I can't seem to find any easy way of setting a bitmap.
Thank you in advance.
http://msdn.microsoft.com/en-us/library/a3y45xs0.aspx
http://msdn.microsoft.com/en-us/library/a1446sbt.aspx
Last edited by GCDEF; December 15th, 2013 at 09:32 PM.
-
December 16th, 2013, 06:50 AM
#3
Re: Use bitmap on button instead of text
Ok, I've tried that with
Code:
m_bitmap.LoadBitmap(IDB_BITMAP);
CButton* pButton = (CButton*)GetDlgItem(IDC_BUTTON1);
pButton->ModifyStyle(0,BS_BITMAP);
pButton->SetBitmap((HBITMAP)m_bitmap);
It works fine.
However, the only way to load the bitmap is by importing it through with Insert->Resource.
In the import process the bmp file is converted to a 4bit bitmap, which is ... kind of retro.
Is there some way of displaying a 24bit bitmap on the button?
-
December 17th, 2013, 12:16 PM
#4
Re: Use bitmap on button instead of text
ResourceView->Right Click on Bitmap using Bitmap Editor change color->24
Height=32
Width=32
-
December 26th, 2013, 02:59 AM
#5
Re: Use bitmap on button instead of text
Originally Posted by rmirani
However, the only way to load the bitmap is by importing it through with Insert->Resource.
LoadImage function
Best regards,
Igor
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|