Sign in to follow this  
brechtjah

Static Control SS_BITMAP

Recommended Posts

I have a Static Control flagged with SS_BITMAP. The size of this Static Control changes dynamically with the MoveWindow() function, however, my bitmap gets resized. I only want the Static Control to cut off a part of my bitmap, because it is meant as a progress bar. How would I go on about this? EDIT: I've tried with the SS_CENTERIMAGE flag, however, it appears that clipping still does not occur Thank you [Edited by - brechtjah on November 11, 2008 5:46:18 AM]

Share this post


Link to post
Share on other sites
I'm not familiar with static controls, but a quick google resulted in Clicky which seems to suggest that SS_CENTERIMAGE *should* do what you want it to. Dunno why you tried it with SS_BITMAP, since "The style ignores the nWidth and nHeight parameters; the control automatically sizes itself to accommodate the bitmap."

If SS_CENTERIMAGE doesn't work as advertised(Though I have to ask, is the bitmap bigger than the control size? and/or Do you have any other flags flagged?) and noone else can help, you may want to look at drawing it yourself(SS_OWNDERDRAW) if you don't mind having to handle the WM_DRAWITEM notification yourself.

Sorry I don't know more.[sad]

Share this post


Link to post
Share on other sites
Quote:
Original post by nerd_boy
I'm not familiar with static controls, but a quick google resulted in Clicky which seems to suggest that SS_CENTERIMAGE *should* do what you want it to. Dunno why you tried it with SS_BITMAP, since "The style ignores the nWidth and nHeight parameters; the control automatically sizes itself to accommodate the bitmap."

If SS_CENTERIMAGE doesn't work as advertised(Though I have to ask, is the bitmap bigger than the control size? and/or Do you have any other flags flagged?) and noone else can help, you may want to look at drawing it yourself(SS_OWNDERDRAW) if you don't mind having to handle the WM_DRAWITEM notification yourself.

Sorry I don't know more.[sad]


When I'm not giving it the SS_BITMAP flag (and only the SS_CENTERIMAGE one), I only get the path for some reason :(

Share this post


Link to post
Share on other sites
Hmmm....

Can you post the relevant code to the creation of the control? That may help reveal what the problem is and/or why the flags are behaving the way they should.

Don't forget about the source tags!

Share this post


Link to post
Share on other sites
//In resource.h
#define ID_bmpBar "C:\\PATH\\prBar.bmp"

// Creation of the bitmap handle
HBITMAP hBmpHealthBar = (HBITMAP)LoadImage(NULL, ID_bmpBar, IMAGE_BITMAP,0,0,LR_LOADFROMFILE);


stcHealth = CreateWindow("STATIC", ID_bmpBar, SS_CENTERIMAGE | WS_VISIBLE | WS_CHILD, 8, 16, 100, 10,
hwnd, (HMENU) ID_stcHealth, hInstance, NULL);

SendMessage(stcHealth, STM_SETIMAGE, (WPARAM)IMAGE_BITMAP, (LPARAM)hBmpHealthBar);


This is all the code I have to create my health bar, however, it only gives me the path when I don't give it the SS_BITMAP flag and when I do it doesn't get centered :(

[Edited by - brechtjah on November 12, 2008 5:19:22 AM]

Share this post


Link to post
Share on other sites
Quote:
Original post by brechtjah
When I'm not giving it the SS_BITMAP flag (and only the SS_CENTERIMAGE one), I only get the path for some reason :(

You need to use SS_BITMAP if you want to have a bitmap in your static. As for the original problem, SS_CENTERIMAGE should clip but if it does not I dont have the time to figure out why, currently.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this