tags:

views:

483

answers:

1

What is the easiest way to convert a RECT struct (tagRECT) or a CRect to a Gdiplus::Rect?

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

works but is a lot of typing.

+1  A: 

If the interface for Gdiplus::Rect doesn't have a convenient constructor, you can make your own function once and use it everywhere.

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