ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Setting the BackColor of a Static Window !! (https://www.excelbanter.com/excel-programming/364667-setting-backcolor-static-window.html)

RAFAAJ2000[_2_]

Setting the BackColor of a Static Window !!
 
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.


RB Smissaert

Setting the BackColor of a Static Window !!
 
I am sure it must be possible, but can't you achieve the same simpler with a
UserForm?

RBS

"RAFAAJ2000" wrote in message
...
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.



RAFAAJ2000[_2_]

Setting the BackColor of a Static Window !!
 
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.




RB Smissaert

Setting the BackColor of a Static Window !!
 
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

"RAFAAJ2000" wrote in message
...
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.






All times are GMT +1. The time now is 03:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com