Solved

Can I put an icon in the top left or top right corner of my CStatic control?

Posted on 2004-08-26
1
231 Views
Last Modified: 2013-11-20

I am able to add an icon to a CStatic control, but it always either resizes the control and puts it at it's top left corner (using SS_ICON flag) or doesn't show up at all (using SS_CENTERIMAGE flag).  I want to put a small icon in the top left (or right) corner of a CStatic control.  Anybody know how I can do this?  Also, anybody know which create flags I CANNOT use if I want to put an icon in it.  I currently create controls  with the following flags:

WS_VISIBLE | WS_CHILD | SS_LEFT | SS_LEFTNOWORDWRAP | WS_TABSTOP | WS_BORDER

which ones do I have to remove to get the icon to appear?

Thanks.



0
Comment
Question by:mromeo
1 Comment
 
LVL 5

Accepted Solution

by:
Nass89 earned 150 total points
ID: 11920399
Hi,
From MSDN:

Icon Styles
Static controls can be used to display icons by using the SS_ICON style. Icon-style static controls are sized to fit the icon when it is displayed; the width and height that the application specifies are ignored. When defining an SS_ICON static control in a resource file, the icon must be defined elsewhere in the resource file, and the icon resource name must be specified as the text for the control. The icon name cannot be a file name. An ICON statement in a resource script file creates this static control:

SampleIcon   ICON  sample.ico
ICON   "SampleIcon", 104, 33, 91, 94, 13

As you see the size of static control is same as Icon,but  I tested the SS_CENTERIMAGE it forces the icon to be displayed in center of static control[you wrote:doesn't show up at all (using SS_CENTERIMAGE flag)].  
SS_LEFT is only for static texts effective.

Good Luck!
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
iSeries FTP Exit Program 8 163
Creating Labels and Frequency list style reports in SAS code 9 113
NotAlone Challenge 20 88
Unix Command -- Challenging  question 7 101
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…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
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.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

749 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