代码之家  ›  专栏  ›  技术社区  ›  Nick

从tagRECT/CRect转换为Gdiplus::Rect

  •  3
  • Nick  · 技术社区  · 17 年前

    最简单的转换方法是什么 RECT 结构( tagRECT )或者 CRect Gdiplus::Rect ?

    Gdiplus::Rect tmpRect(rect.top, rect.left, rect.Width(), rect.Height());
    

    很有用,但需要大量的打字。

    2 回复  |  直到 17 年前
        1
  •  2
  •   Kevin Smyth    14 年前

    签名是 Rect([in] INT x, [in] INT y, [in] INT width, [in] INT height); 应该是的

    Gdiplus::Rect CopyRect(RECT &rect)
    {
        return Gdiplus::Rect(rect.left, rect.top, rect.Width(), rect.Height());
    }
    
        2
  •  2
  •   Mark Ransom    12 年前

    Gdiplus::Rect CopyRect(const RECT &rect)
    {
        return Gdiplus::Rect(rect.left, rect.top, rect.Width(), rect.Height());
    }