<!DOCTYPE html><html><head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 12 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<style type="text/css">body { font-family:'Times New Roman'; font-size:13px}</style>
</head>
<body lang="EN-US" link="blue" vlink="purple"><div>Hi Sumit,</div><div><br></div><div>There is a Visual Studio 2010 "wizard" for C++ decorators, like there is for interpreters. Run the script at "C:\Program Files (x86)\GME\SDK\DecoratorWizard\setup100.js" and the decorator project type will show up under New Project in VS2010.</div><div><br></div><div>Here's an example DrawBackground method that draws a bitmap at fixed (non-scaled) size if m_bStretch is false, and draws a rounded rectangle background:</div><div><br></div><div>CSize cExtentD = pDC->GetViewportExt();<br>CSize cExtentL = pDC->GetWindowExt();<br>if (m_bStretch && m_bmp.get())<br>{<br>        CRect cRect = TypeableBitmapPart::GetBoxLocation(false);<br>        Gdiplus::Rect grect(cRect.left, cRect.top, cRect.Width(), cRect.Height());<br>        gdip->DrawImage(m_bmp.get(), grect, 0, 0, m_bmp->GetWidth(), m_bmp->GetHeight(), Gdiplus::UnitPixel);<br>}<br>else<br>{<br>        CRect cRect = TypeableBitmapPart::GetBoxLocation(false);<br>        cRect.BottomRight() -= CPoint(1, 1);<br><br>        CRect location = cRect;<br>        if (m_LeftPorts.size() != 0 || m_RightPorts.size() != 0)<br>        {<br><br>                Gdiplus::Rect rect(cRect.left, cRect.top, cRect.Width(), cRect.Height());<br>                Gdiplus::LinearGradientBrush linearGradientBrush(rect,<br>                        Gdiplus::Color(GetRValue(m_crBrush), GetGValue(m_crBrush), GetBValue(m_crBrush)),<br>                        Gdiplus::Color(GetRValue(m_crGradient), GetGValue(m_crGradient), GetBValue(m_crGradient)),<br>                        Gdiplus::LinearGradientModeVertical);<br><br>                Gdiplus::SolidBrush solidBrush(Gdiplus::Color(GetRValue(m_crBrush), GetGValue(m_crBrush), GetBValue(m_crBrush)));<br>                <br>                Gdiplus::Brush& brush = m_bGradientFill ? (Gdiplus::Brush&)linearGradientBrush : (Gdiplus::Brush&)solidBrush;<br>                <br>                Gdiplus::GraphicsPath path;<br>                int cornerRadius = 15;<br>                path.AddArc(location.left, location.top, cornerRadius, cornerRadius, 180, 90);<br>                path.AddArc(location.right - cornerRadius, location.top, cornerRadius, cornerRadius, 270, 90);<br>                path.AddArc(location.right - cornerRadius, location.bottom - cornerRadius, cornerRadius, cornerRadius, 0, 90);<br>                path.AddArc(location.left, location.bottom - cornerRadius, cornerRadius, cornerRadius, 90, 90);<br>                gdip->FillPath(&brush, &path);<br>        }<br><br>        if (m_bmp.get())<br>        {<br>                int height = m_bmp->GetHeight();<br>                int width = m_bmp->GetWidth();<br>                Gdiplus::Rect grect((int)cRect.left + cRect.Width() / 2 - (int)m_bmp->GetWidth() / 2, (int)cRect.top + cRect.Height() / 2 - (int)m_bmp->GetHeight() / 2,<br>                        width, height);<br>                gdip->DrawImage(m_bmp.get(), grect, 0, 0, (int)m_bmp->GetWidth(), (int)m_bmp->GetHeight(), Gdiplus::UnitPixel);<br>        }<br>}<br><br>for (std::vector<Decor::PortPart*>::iterator ii = m_LeftPorts.begin(); ii != m_LeftPorts.end(); ++ii) {<br>        (*ii)->Draw(pDC, gdip);<br>}<br>for (std::vector<Decor::PortPart*>::iterator ii = m_RightPorts.begin(); ii != m_RightPorts.end(); ++ii) {<br>        (*ii)->Draw(pDC, gdip);<br>}<br></div><div><br></div><div>Kevin</div><div><br></div><div>On Fri, 26 Apr 2013 09:19:58 -0500, Ray, Sumit (US SSA) <sumit.ray@baesystems.com> wrote:<br></div><br><blockquote style="margin: 0 0 0.80ex; border-left: #0000FF 2px solid; padding-left: 1ex">
<div class="WordSection1">
<p class="MsoNormal">Hi,</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">I’m thinking about writing a decorator module that allows an object to scale based on its ports or other information that we want on its object display but has a fixed size icon in the center. What’s the best way to start this activity?</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Thanks,</p>
<p class="MsoNormal">Sumit</p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</blockquote><br><br><br></body></html>