Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Icons on CButton

Posted on 1998-06-08
4
Medium Priority
?
768 Views
Last Modified: 2013-11-19
This is probably an easy question to answer but here goes:  how do I change the display size of an icon (or set it) on a CButton?  I have a 16x16 icon that seems to be displayed in 32x32 by default.  Thanks.
0
Comment
Question by:mpenner
  • 2
4 Comments
 
LVL 1

Expert Comment

by:guruprasad031298
ID: 1316230
For converting from 32X32 to 16X16, load the icon through the resource editor and convert
it from 32X32 to 16X16 by setting the target device to 16X16.

To load the Icon, use LoadIcon member function of CWinApp. This will return a handle to the Icon object (HICON). Use the SetIcon member function of CButton to the Icon, passing it's handle (HICON)

Hope this helps !!!
0
 

Author Comment

by:mpenner
ID: 1316231
This icon has only been made as a 16x16 icon.  It has been successfully displayed on the button but appears as a 32x32 icon.  
0
 
LVL 1

Accepted Solution

by:
Andy_Keys earned 200 total points
ID: 1316232
Try this.
hIcon = (HICON)LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE( IDI_<MyIcon> ),
IMAGE_ICON,
16,16,
LR_DEFAULTCOLOR);
This forces the use of the 16*16 icon image not the std 32*32 image
0
 

Author Comment

by:mpenner
ID: 1316233
Thanks a lot.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
Introduction: Hints for the grid button.  Nested classes, templated collections.  Squash that darned bug! Continuing from the sixth article about sudoku.   Open the project in visual studio. First we will finish with the SUD_SETVALUE messa…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question