Solved

Icons on CButton

Posted on 1998-06-08
4
670 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanks a lot.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Shell script to login to remote m/c and execute commands 10 72
haveThree challenge 22 100
MaxSpan challenge 9 65
Detect file exist or not 3 73
Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
This video discusses moving either the default database or any database to a new volume.

728 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now