自定义窗口框架 - 平滑边框? [英] Custom window frame - Smooth border?
问题描述
我通过在我的消息处理程序中处理 WM_NCPAINT 消息在我的应用程序中绘制自定义边框.问题是即使设置了窗口区域后,我的应用程序的角落也不平滑".
I'm drawing a custom border in my application by handling the WM_NCPAINT message in my message handler. The problem is that even after setting the window region, the corners of my app aren't "smooth".
我想也许我可以为屏幕获取 HDC 并在角落周围插入像素以获得半透明效果,但看到当用户移动窗口时我必须不断重新绘制边框,我不要认为这是一个有效的选择.
I thought that maybe i could just get the HDC for the screen and interpolate the pixels around the corners to get a translucency effect, but seeing as i would have to re-draw the border constantly when the user moves the window, i don't think it's a valid option.
有没有人知道一种模拟半透明或至少平滑角落附近的边界的方法?
Does anyone know of a way to simulate translucency or at least smooth out the border near the corners?
角是这样的:
提前致谢.
推荐答案
使用 分层窗口.这适用于 Windows 2000 及更高版本.
Use a Layered Window. This works from Windows 2000 onwards.
如果您想要 Aero Glass 效果(Vista 以上),则 这篇文章 对历史绘画技术和使用桌面窗口管理器的详细信息进行了很好的概述.
If you want Aero Glass effects (Vista onwards) then this article has a nice overview of historical painting techniques and details on using The Desktop Window Manager.
这篇关于自定义窗口框架 - 平滑边框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!