Solved

Icons on CButton

Posted on 1998-06-08
4
738 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 50 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

This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
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.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

690 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