CRgn ScreenToClient [英] CRgn ScreenToClient

查看:77
本文介绍了CRgn ScreenToClient的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个自定义绘制的CStatic,它们使用SetWindowRgn为其赋予每个不规则(非矩形)形状.我需要使每个控件OnEraseBkgnd后面的区域无效,为此,我想在父级CDialog上使用CWnd::InvalidateRgn,但是我需要将CRgn转换为父级的坐标.我想要类似Cwnd::ScreenToClient(CRgn *)的东西,但据我所知,不存在这样的东西.

I have several Custom Drawn CStatic which use SetWindowRgn to give each of them an irregular (non-rectangular) shape. I need to Invalidate a the region behind each of these Controls OnEraseBkgnd, for which I would like to use CWnd::InvalidateRgn on the parent CDialog however I need to translate the CRgn into the coordinates of the parent. I would like to have something like Cwnd::ScreenToClient(CRgn *) but as far as I can see no such thing exists.

我如何获得等价于CWnd::ScreenToClient的CRgn?

How do I get the equivalent of CWnd::ScreenToClient that takes a CRgn?

推荐答案

  • 使用CRgn区域拆分为矩形GetRegionData
  • ScreenToClient单个矩形
  • 使用CreateFromData
  • 将输出组合回区域

    • Split CRgn region into rectangles using GetRegionData
    • ScreenToClient individual rectangles
    • Combine the output back into region using CreateFromData
    • 替代选项是 CRgn::OffsetRgn 使用从ScreenToClient获得的单个点的距离来干扰该区域.

      An alternate option is CRgn::OffsetRgn to offet the region using the distance obtained from ScreenToClient for an individual point.

      这篇关于CRgn ScreenToClient的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆