windows – 从剪切区域中排除圆角矩形?

使用Delphi / GDI从剪切区域中排除圆角矩形的正确方法是什么?

存在ExcludeClipRect以排除矩形区域,并且CreateRoundRectRgnSelectClipRgn一起将剪切区域设置为圆形矩形.

但是如何从剪切区域中排除圆形矩形(类似于ExcludeClipRoundRect或ExcludeClipRgn)?我用CombineRgn进行了实验,但没有得到它的工作.

解决方法

感谢@TLama的评论我能够像这样解决它:

Region := CreateRectRgn (0,ClientWidth,ClientHeight);
ExcludedRegion := CreateRoundRectRgn (1,1,ClientWidth - 1,ClientHeight - 1,3,3);
CombineRgn (Region,Region,ExcludedRegion,RGN_XOR);
SelectClipRgn (Canvas.Handle,Region);

之前的问题是尚未创建作为CombineRgn的第一个参数传递的区域.链接教程中的一句话提供了线索:

One more thing to point out is that the destination region in
CombineRgn can be one of the source regions.

连同MSDN的这些信息:

hrgnDest [in]: A handle to a new region with dimensions defined by combining two other regions. (This region must exist before CombineRgn is called.)

相关文章

Windows2012R2备用域控搭建 前置操作 域控主域控的主dns:自...
主域控角色迁移和夺取(转载) 转载自:http://yupeizhi.blo...
Windows2012R2 NTP时间同步 Windows2012R2里没有了internet时...
Windows注册表操作基础代码 Windows下对注册表进行操作使用的...
黑客常用WinAPI函数整理之前的博客写了很多关于Windows编程的...
一个简单的Windows Socket可复用框架说起网络编程,无非是建...