组合Rgn不工作

发布于 2024-09-06 16:44:14 字数 258 浏览 0 评论 0原文

我有两个区域:rgn1rgn2。我想使用CombineRgn 函数将它们组合起来。所以我写 -

if CombineRgn(rgnMain,rgn1,rgn2,RGN_OR) = error then
         ShowMessage('error'); 

它给出的返回值是错误的。

我已经测试过 rgn1 和 rgn2 是正确的区域。
谢谢。

I have two region say rgn1 and rgn2. I wanted to combine both of them using CombineRgn function. So I write -

if CombineRgn(rgnMain,rgn1,rgn2,RGN_OR) = error then
         ShowMessage('error'); 

Its giving return value as ERROR.

I have tested that rgn1 and rgn2 are correct region.
Thank You.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄离 2024-09-13 16:44:14

您还初始化了rgnMain吗?有点违反直觉(但如 CombineRgn() 文档中所述)目标/输出区域必须存在才能接收两个输入区域的所需组合,但它可以是一个完全空的区域:

rgnMain := CreateRectRgn(0, 0, 0, 0);
if CombineRgn(rgnMain, rgn1, rgn2, RGN_OR) ... then
  // etc

如果您希望避免创建一个完全独立的区域,那么指定以下之一是可以接受的输入区域作为目标区域(根据定义,输入区域必须是现有的有效区域,这样就避免了必须单独初始化新的目标区域):

if CombineRgn(rgn1, rgn1, rgn2, RGN_OR) ... then
  // etc

Have you also initialised rgnMain? Somewhat counterintuitively (but as described in the documentation for CombineRgn()) the destination/output region must exist in order to receive the required combination of the two input regions, but it can be an entirely empty region:

rgnMain := CreateRectRgn(0, 0, 0, 0);
if CombineRgn(rgnMain, rgn1, rgn2, RGN_OR) ... then
  // etc

If you wish to avoid having to create an entirely separate region then it is acceptable and possible to specify one of the input regions as the destination region (by definition an input region must be an existing, valid region so this avoids having to separately initialise a new destination region):

if CombineRgn(rgn1, rgn1, rgn2, RGN_OR) ... then
  // etc
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文