views:

338

answers:

1

I made a window sitter in Visual Basic 6 a few years back, which used layered windows colorkeying to painlessly make the form nonrectangular.

I tried to rewrite the window sitter in C# earlier this week, judging that the old code was a mess, and noticed that any clicks within the form's client rectangle were caught by the form, while the VB6 version's clicks fell through to whatever was below if you didn't click within any visible parts. This is a very important matter ofcourse.

Is there some difference between calling the Layered Windows API by hand (VB6) and the TransparancyKey property (.Net) that I'm not aware of, or is there more at hand here?

A: 

There are a couple of bugs related to TransparencyKey. Neither seems to be the case you're discussing here, but I wouldn't be surprised if there are more issues with the API.

We'll need to see some code to try and diagnose what is going on exactly.

Kevin Montrose
There -is- no relevant code on the C# side, only that property. I don't have access to the original VB6 version, but that was at most two API calls to set up the colorkey...
Kawa
A SetWindowLong to enable the Layered Windows thing in the first place, then SetLayeredWindowAttributes with LWA_COLORKEY and the color red. Nothing more to it, worked like a charm. In fact, detecting too-old versions of Windows needed more code.
Kawa
The Form involved is relevant. Bugs can be triggered based off of bit-depth, buffering scheme, etc.
Kevin Montrose
Well, I suppose classic regions are my best option then. It's not like they need to change very often and fast...
Kawa