非标准形状抗锯齿 WPF 窗口
我正在使用 C# 创建一个非标准形状的 WPF 窗口,由于“AllowTransparency=True”的一些问题,我使用了 CreateRoundRectRgn、CreateEllipticRgn 和 SetWindowRgn win32 API 区域函数,但有一个问题,因为边缘不平滑,正如您在此处的图片中看到的 http: //img17.imageshack.us/img17/206/sampley.png:
alt text http://img17.imageshack.us/img17/206/sampley.png
如何实现抗锯齿,使边缘看起来更平滑?
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 ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你不能,抗锯齿边缘需要每像素 alpha 通道(AllowTransparency=true 的作用) - 但是当你打开该选项时(无论是使用AllowTransparency 还是通过调用 Win32 API,结果是相同的)你会进入一大堆麻烦——就像你已经发现的那样。
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.