Nathan
Nathan

Reputation: 131

Clicking Through a Form?

So I have this code:

private void PanelsFade()
{
    var _initialStyle = GetWindowLong(Handle, -20);
    SetWindowLong(this.Handle, -20, _initialStyle | 0x80000 | 0x20);
    if (Opacity == 1) {
        Opacity = 0.5;
    }
}

private void PanelsShow()
{
    var _initialStyle = GetWindowLong(Handle, -20);
    SetWindowLong(this.Handle, -20, _initialStyle | ~(0x80000 | 0x20));
    if (Opacity == 0.5) {
        Opacity = 1;
    }
}

When I fade the panels I can click through them as supposed, but when I restore the panels (PanelsShow()) I can still click through them (unable to click buttons, etc)...

Upvotes: 0

Views: 98

Answers (1)

Visual Vincent
Visual Vincent

Reputation: 18310

I tested you code, and what you are doing is not a correct way of removing a bitwise combined number.

This:

_initialStyle | ~(0x80000 | 0x20)

should be this:

_initialStyle & ~(0x80000 | 0x20)

Upvotes: 1

Related Questions