Solved

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

Posted on 2004-08-26
1
229 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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
VBA "SendKeys" Syntax for Multiple Keystrokes 7 117
Doc'in system (example?) BA 7 115
countEvens challenge 2 112
has77  challenge 9 90
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: Dialogs (1) modal - maintaining the database. Continuing from the ninth article about sudoku.   You might have heard of modal and modeless dialogs.  Here with this Sudoku application will we use one of each type: a modal dialog …
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 shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

860 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