SaguiItay

My blog has moved!

You should be automatically redirected in 4 seconds. If not, visit:
http://itaysagui.wordpress.com
and update your bookmarks.

Thursday, September 6, 2007

Transparent Click-thru windows

It is often usefull to provide the user with information on the screen, without interfering his work. Usually, you would just create a window with a somewhat lower opacity, allowing the user to see what’s beneath your window. However, this window will still receive all the normal windows events, and mostly, the user’s mouse clicks. To prevent this, all you have to do is override the window’s CreateParams accessor, and add to the ExStyle property the WS_EX_TRANSPARENT value. Let’s have a look:
protected override CreateParams CreateParams
{
    get
    {
        CreateParams cp = base.CreateParams;
        cp.ExStyle = 0×00000020;
        return cp;
    }
}

Labels: , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]



<< Home