Solved

Icons on CButton

Posted on 1998-06-08
4
711 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 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Login Script to Copy Folders 12 42
Replacement selected text 2 63
MaxSpan challenge 9 106
Fibonacci challenge 11 133
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…
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.

829 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