Make my control invisible

Due to problems with making transparent, non flickering conrol in Win I got an idea, that my control wont paint itself, but will force parent container to paint it. I thought, still it should handle events like MouseDown, MouseEnter etc... I have noticed, that if I set Visible attribute to false, it still handles some events, but not all of them - for example, doesn't fire OnPaint (obvious : ) )

How to make my control to handle All the events, but still that it wouldnt be painted? Overriding OnPaint and OnPaintbackground and leaving it empty wouldnt do the thing I guess...

[586 byte] By [bucz] at [2008-1-9]
# 1

Have you tried to activate double buffering to avoid flickering?

Fábio at 2007-10-3 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 2

In case you don't know, some controls dont expose the doublebufferd property. You must inherit the control

and override the DoubleBuffered property in order to enable double buffering of a button for instance.

Fábio at 2007-10-3 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 3
I know Double Buffering, but when you want to paint transparent images on your own (handling alpha) you cannot use double buffering (as far as I know) because you need to use OnPaintBackground

bucz at 2007-10-3 > top of Msdn Tech,Windows Forms,Windows Forms General...
# 4

Hi, bucz,

Based on my understanding, you want to make the controls invisible but all events work, don't you?

In my point of view, you will have to make the controls transparent not invisible, or the Paint event will never get triggered.

There comes a problem, some controls, such as TextBox, RichTextBox, Panels, won't get transparent even you change their BackColor to transparent, because each of them is just a wrapper of the current win32 control, and you will find that although you can override the OnPaint and OnPaintBackground, you cannot change anything there. The solution is that you will have to deal with the Win32 API.

To change the controls transparent,please check the following urls,

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2002898&SiteID=1

http://www.codeproject.com/cs/miscctrl/alphablendtextbox.asp

http://www.codeproject.com/cs/miscctrl/TransparentTextBox.asp

Hope this helps,

Regards

YuGuo–MSFT at 2007-10-3 > top of Msdn Tech,Windows Forms,Windows Forms General...