views:

150

answers:

3

Is there a way to make input "pass through" a child window and reach its parent? My problem is this: I'm making custom control with a label that can be formatted. So, rather than trying to re-invent the wheel, I added a RichTextEdit control and applied the WS_EX_TRANSPARENT extended window style. It looks like what I want, but there are obvious focus and input issues. Is there an effective way to pass on the child window's messages to the parent or apply a set of styles thus making the child window appear to just be text drawn on the button?

A: 

You could use PostMessage to send windows messages to your child window.

James
A: 

Have you tried setting TabStop False and Locked True?

Apologies if you have already tried it.

MarkJ
I would try setting WS_DISABLED on the richedit instead.
wqw
Disabled controls have a different look, but im using the WM_PAINT/Blt method. Thanks though.
Xiphias3
Yes, but in this case you can always put it in a PictureBox and disable it instead, to retain enabled look with disabled interaction
wqw
A: 

You can do this fairly easily by overriding the WM_NCHITTEST message and returning HTTRANSPARENT. Just be sure to turn off WS_TABSTOP also so the control cannot be tabbed into.

Stephen Nutt
Wow thanks! I'll definitely keep this in mind, however i went with the TransparentBlt method and kept a 32bpp image of the text so i can apply image transformation through the use of a ColorMatrix with GDIPlus. Thanks again.
Xiphias3