Solved

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

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

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.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

747 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

11 Experts available now in Live!

Get 1:1 Help Now