Just in case no one else answers.
You question is has been asked many many times before (like here
The issue, as HDC_0 explains in the last post
of in this thread
The textbox control doesn't usually "expose" it's device context
except through subclassing..
So now you are probably going to ask:
"I can't find an example of subclassing a textbox - help me!"
There used to be a site called "EliteVB" maintained by someone called "TheHand".
When his site site shut down he made arrangements with the people who used
to run the forum to have his sub-classing examples transferred to the XVBT forum's CodeLibrary,
and thus, attached to this post
, you can find an example of what it takes to subclass a textbox.
Of course that just demonstrates "simple" transparency.
"What about alphablending
text?" you ask.
(yes, unbelievably, it really helps if you use the "fancy" programming terms like "alphablending"
when talking about such things on a programmers forum..)
Well a quick search of the forum brings up this thread
which has a link in the first post to rpgnewbie's fader with speed adjust post
Thus I anticipate your next question:
"Well that example uses two picturebox controls,
how can I adapt it to use text generated at runtime".
The alphablending part is still valid
but you to do a little more work to "paint" the text:
1.) Copy whatever graphics that lies underneath the textbox control
(using the form's device context) into two separate memDC backbuffers.
2.) In memory device context backbuffer #1 you draw text
over the graphics.
3.) Then you use the the alpha-blending code to merge the two
memDC backbuffers (graphic image & graphic image with text overlaid),
into a single image / picture showing the semi-transparent text.
4.) "Flip" (transfer) the combined graphic into a picturebox
(with the picbox control's AutoRedraw property set to true)
using the Bitblt API.
Yes --its a little bit involved.
That's why you probably won't get a lot of replies to this post
and why there aren't already hundreds of semi-transparent textbox controls out there.
If you really want to go all out you can also get per pixel semi-transparency using DIBSections
Note: If you only need to a show just a few lines of text semi-transparency,
instead of creating a special custom ocx yourself,
I would make up the all the needed lines of text (at design time) as a png,
and then just use LaVolpe's AlphaImage control
There is a more advanced version off forum