|
-
October 3rd, 1999, 05:36 PM
#1
Using an icon as a button's face
I have a class derived from CDaoRecordView with two buttons on it. I want to use icons I made as the faces of these buttons. In my CMyRecordView::OnInitialUpdate() I have the following code:
CButton *curButton = (CButton*)GetDlgItem(IDC_BUTTON_CV_ADD);
curButton->SetIcon(::LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON_CV_ADD)));
// curButton->UpdateData();
curButton = (CButton*)GetDlgItem(IDC_BUTTON_CV_SUB);
curButton->SetIcon(::LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON_CV_SUB)));
// curButton->UpdateData();
But when I run my program I have two blank buttons. How do I get the icons to show up correctly?
Thanks,
Erik
-
October 3rd, 1999, 07:08 PM
#2
Re: Using an icon as a button's face
Did you check appropriate style of the button in resource editor? It must be set to Icon.
There are only 10 types of people in the world:
Those who understand binary and those who do not.
-
October 3rd, 1999, 07:53 PM
#3
Re: Using an icon as a button's face
-
October 3rd, 1999, 08:16 PM
#4
Re: Using an icon as a button's face
Got it. I have overlooked something.
Change:
curButton->SetIcon(::LoadIcon(NULL, MAKEINTRESOURCE(IDI_ICON_CV_ADD)));
To:
curButton->SetIcon(::LoadIcon(AfxGetInstanceHandle(),MAKEINTRESOURCE(IDI_ICON_CV_ADD)));
There are only 10 types of people in the world:
Those who understand binary and those who do not.
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
|