Setting the BackColor of a Static Window !!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all.

I am not sure I should be asking this question here but since it is somewhat
related to Excel here it goes :

I have created a Static Window via the "CreateWindowEx" API and placed it
floating over a worksheet Cell... With some tweaking and changing some Styles
this Static window now works and looks just fine.

However, what I now need is to be able to change is its BackColor after it's
been created.

I have tried the "SetBckColor" API, Sending as well as trapping the
"WM_CTLCOLORSTATIC" Window Message among other things but just can't succeed
to change the backcolor of this newly created Static Window :(

I googled for an answer but no luck .

Anyone here has an answer to this one ?

Thank you.
 
I am sure it must be possible, but can't you achieve the same simpler with a
UserForm?

RBS
 
Thanks Smissaert .

No . I can't use a UserForm as I would need to reduce its Width to macth
that of the underlying Worksheet Cell.

Apparently, an XL Userform Width can't be reduced below a certain level even
after removing its title bar, caption and changing other of its Styles. I
have already tried doing this via various APIs but failed ! I hope I am wrong
though in which case I would definitely use a UserForm for this instead of a
Static Window.

I can't beleive that such seemingly easy thing ie: Simply setting the
BackColor of a Window programatically can be that difficult !!!!

I hope someone knows the answer to this one.

Regards.
 
OK, if you post the code you have sofar in the NG:
microsoft.public.vb.winapi and/or microsoft.public.vb.general.discussion
then I am sure somebody will tell you how to set the background color.

RBS
 
Back
Top