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.
Re: Use bitmap on button instead of text
Quote:
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
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?
Re: Use bitmap on button instead of text
ResourceView->Right Click on Bitmap using Bitmap Editor change color->24
Height=32
Width=32
Re: Use bitmap on button instead of text
Quote:
Originally Posted by
rmirani
However, the only way to load the bitmap is by importing it through with Insert->Resource.
LoadImage function