Transparency

B

Ben Taylor

Hi,
I am building an ActiveX control, which I would like NOT
to be windowless (e.g. the common dialog control in Visual
Basic being an example of one that is windowless, I don't
want one like this), i.e. I want it to draw and have size,
etc. but be largely transparent. I can sort of mimic
transparency by using TranslateColor(AmbientBackColor())
but this doesn't take into account the fact that the
developer using it might want to have, say, static text
behind my control.
So what I want to do which I would appreciate any help
anybody can possibly give me, is *ideally* to create a
bitmap which contains the bits behind my control - I'm
lost as to where to start though, I'm really new in C++,
my previous language is VB. I could then BitBlt parts of
this bitmap to my control's window, so it would appear
invisible but just displaying the same pixels as the
background in that position.

Does anybody know how to do this, is it a simple function
or does it require complex subclassing or hooks or
something? I'd love to learn how to do this if it is but
please explain it as I have only been at this language for
a few months and am still picking it up.

Also, I might be pusing it here, but aswell as that, is
there an easy way of propogating click events, etc.
through to any controls which may be beneath mine? (If
this sounds really difficult even for you guys please let
me know then I'll know not to bother trying!)
 
I

Igor Tandetnik

Ben Taylor said:
I am building an ActiveX control, which I would like NOT
to be windowless (e.g. the common dialog control in Visual
Basic being an example of one that is windowless, I don't
want one like this)

I think you are confusing a windowless control (a control that has UI
but does not have its own HWND, instead painting directly on the
container's window) with a control that's invisible at run-time (a
control that does not have any UI at all, except a rather boring icon in
designer that's there just so you can select it and access its
properties). Common dialog control is of the latter variety.
, i.e. I want it to draw and have size,
etc. but be largely transparent.

Windowless control fits the bill.
--
With best wishes,
Igor Tandetnik

"For every complex problem, there is a solution that is simple, neat,
and wrong." H.L. Mencken
 
B

Ben Taylor

I've just seen your reply to my further message, thanks for that. Would you
still be able to create the DC variable in the same way, i.e. using
CClientDC dc(this) ?

Also I don't suppose you know how to add the text that VB programmer would
see as the description in the object browser? i.e. the C++ control-creating
equivalent of using Tools, Procedure attributes, description, in Visual
Basic.

Thanks a lot
Ben
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top