<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : HOWTO: CXTPControlCustom background in ribbon?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : HOWTO: CXTPControlCustom background in ribbon?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 13 Jun 2026 09:38:28 +0000</pubDate>
  <lastBuildDate>Tue, 22 Mar 2011 05:52:28 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=18098</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[HOWTO: CXTPControlCustom background in ribbon? :   Hi;I created a custom control...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18098&amp;PID=63453&amp;title=howto-cxtpcontrolcustom-background-in-ribbon#63453</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=109">mgampi</a><br /><strong>Subject:</strong> 18098<br /><strong>Posted:</strong> 22 March 2011 at 5:52am<br /><br />Hi;<br><br>I created a custom control derived from CWnd that contains a CEdit (masked) and a CXTPButton. This control ist used in dialogs and views and now I want to use this control as a CXTPControlCustom in my apps ribbon bar.<br>So far so good, but I can't find out how to handle the background drawing when contained in riboon (see screenshot).<br>For skinned dialogs the&nbsp; background drawing is ok, but in ribbons not!<br><br>Here's my OnPaint() function of the CWnd derived custom control:<br><br><table width="99%"><tr><td><pre class="BBcode">void CXRTimeStampCtrl::OnPaint()<br>{<br>&nbsp;&nbsp;&nbsp; CPaintDC dc(this); // device context for painting<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; CRect rect;<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; DWORD dwStyle=GetStyle();<br><br>&nbsp;&nbsp;&nbsp; GetClientRect(&amp;rect);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp; if (BackColor_!=0xFFFFFFFF)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dc.FillSolidRect(rect, BackColor_);<br>&nbsp;&nbsp;&nbsp; else {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; HBRUSH hBrush=reinterpret_cast&lt;HBRUSH&gt;(GetParent()-&gt;SendMessage(WM_CTLCOLORSTATIC, reinterpret_cast&lt;WPARAM&gt;(dc.m_hDC), reinterpret_cast&lt;LPARAM&gt;(m_hWnd)));<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dc.FillSolidRect(rect, dc.GetBkColor());<br>&nbsp;&nbsp;&nbsp; }<br>&nbsp;&nbsp;&nbsp; if (dwStyle &amp; TSCS_SHOWCAPTION)<br>&nbsp;&nbsp;&nbsp; {<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CFont* pOldFont=dc.SelectObject(&amp;_fontCaption);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CString strText;<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; GetWindowText(strText);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dc.DrawText(strText, rect, DT_LEFT|DT_END_ELLIPSIS|DT_SINGLELINE|DT_VCENTER);<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; if (pOldFont)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; dc.SelectObject(pOldFont);<br>&nbsp;&nbsp;&nbsp; }<br>}</pre></td></tr></table><br><br>And here's the result in ribbon (left) and dialog (right):<br><br><img src="uploads/109/22-03-2011_10-34-16.png" height="122" width="288" border="0" /><img src="uploads/109/22-03-2011_10-50-00.png" height="69" width="197" border="0" /><br><br>Any help is very welcome!<br>]]>
   </description>
   <pubDate>Tue, 22 Mar 2011 05:52:28 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18098&amp;PID=63453&amp;title=howto-cxtpcontrolcustom-background-in-ribbon#63453</guid>
  </item> 
 </channel>
</rss>