Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

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

Posted on 2004-08-26
1
Medium Priority
?
249 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 5

Accepted Solution

by:
Nass89 earned 600 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

Introduction: Displaying information on the statusbar.   Continuing from the third article about sudoku.   Open the project in visual studio. Status bar – let’s display the timestamp there.  We need to get the timestamp from the document s…
In this post we will learn different types of Android Layout and some basics of an Android App.
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.
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

596 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