Search code examples
c#.netwpfantialiasingregion

non standard shape antialiased WPF window


I'm using C# to create a non standard shape WPF window, and because of some problems with "AllowTransparency=True", I used CreateRoundRectRgn, CreateEllipticRgn and SetWindowRgn win32 API Region functions, but there's a problem cause the edges are not smooth as you can see in the picture here http://img17.imageshack.us/img17/206/sampley.png:

alt text http://img17.imageshack.us/img17/206/sampley.png

How can I achieve antialiasing for the edges to look more smooth ?


Solution

  • You can't, anti-aliased edges require per-pixel alpha channel (what AllowTransparency=true does) - but when you turn that option on (either using AllowTransparency or by invoking the Win32 API, the result is the same) you get into a whole lot of trouble - like you already discovered.