<?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 : CJ Control for displaying .png</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Visual C++ MFC : CJ Control for displaying .png]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 09 Apr 2026 18:07:07 +0000</pubDate>
  <lastBuildDate>Sun, 29 Mar 2009 20:24:22 +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=13826</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[CJ Control for displaying .png : Hi SuperMario,  Yeah, I&amp;#039;ve...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=13826&amp;PID=47275&amp;title=cj-control-for-displaying-png#47275</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=5059">doinIT</a><br /><strong>Subject:</strong> 13826<br /><strong>Posted:</strong> 29 March 2009 at 8:24pm<br /><br />Hi SuperMario,<DIV>&nbsp;</DIV><DIV>Yeah, I've looked at the button sample and have tried it in my own app. It works ok, but I can still faintly see the outline of the button even though it is being rendered transparently in flat style.</DIV><DIV>&nbsp;</DIV><DIV>It's as if the background of the button isn't getting the right brush offset of the background image. I've posted my OnCtlColor routine if you can see anything that looks off.</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2><P>HBRUSH CHDMSDiag::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)</P><P>{</P><P>HBRUSH hbr;</P><P>&nbsp;</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>( nCtlColor == CTLCOLOR_STATIC || nCtlColor == CTLCOLOR_BTN || nCtlColor == CTLCOLOR_DLG || nCtlColor == CTLCOLOR_EDIT )</P><P>{</P><P></P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(img){</P><P>m_brush = CreatePatternBrush(img); </FONT><FONT color=#008000 size=2><FONT color=#008000 size=2>// Previously created CImage</P></FONT></FONT><FONT size=2><P></P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2> (pWnd-&gt;m_hWnd != </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>-&gt;m_hWnd)</P><P>{</P><P>CXTPWindowRect rcPaint(pWnd);</P><P>CXTPWindowRect rcBrush(m_hWnd);</P><P>HDC hDC = pDC-&gt;m_hDC;</P><P>::SetBrushOrgEx(hDC, rcBrush.left - rcPaint.left, rcBrush.top - rcPaint.top, NULL);</P><P>::SetBkMode(hDC, TRANSPARENT);</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(nCtlColor == CTLCOLOR_STATIC){</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>if</FONT></FONT><FONT size=2>(pWnd-&gt;m_hWnd != </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>-&gt;GetDlgItem(IDC_DRIVE2_ICON)-&gt;GetSafeHwnd()</P><P>&amp;&amp; pWnd-&gt;m_hWnd != </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>-&gt;GetDlgItem(IDC_DRIVE1_ICON)-&gt;GetSafeHwnd()</P><P>&amp;&amp; pWnd-&gt;m_hWnd != </FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>this</FONT></FONT><FONT size=2>-&gt;GetDlgItem(IDC_DRIVE_1)-&gt;GetSafeHwnd()){</P><P></P><P>pDC-&gt;SetBkMode(TRANSPARENT);</P><P>::SetTextColor(hDC, RGB(255, 255, 255));</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> (HBRUSH)GetStockObject(NULL_BRUSH); </P><P>}</FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</P></FONT></FONT><FONT size=2><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>int</FONT></FONT><FONT size=2> test = 0;</P><P></P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</P></FONT></FONT><FONT size=2><P>::SetTextColor(hDC, RGB(255, 255, 255));</P><P>}</P><P></P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> m_brush; </P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>else</P></FONT></FONT><FONT size=2><P>{</P><P>hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);</P><P>}</P><P></FONT><FONT color=#0000ff size=2><FONT color=#0000ff size=2>return</FONT></FONT><FONT size=2> hbr;</P><P>}</P></FONT></DIV>]]>
   </description>
   <pubDate>Sun, 29 Mar 2009 20:24:22 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=13826&amp;PID=47275&amp;title=cj-control-for-displaying-png#47275</guid>
  </item> 
  <item>
   <title><![CDATA[CJ Control for displaying .png : Have you tried the button sample? ...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=13826&amp;PID=47231&amp;title=cj-control-for-displaying-png#47231</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=369">SuperMario</a><br /><strong>Subject:</strong> 13826<br /><strong>Posted:</strong> 27 March 2009 at 1:10pm<br /><br />Have you tried the button sample?]]>
   </description>
   <pubDate>Fri, 27 Mar 2009 13:10:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=13826&amp;PID=47231&amp;title=cj-control-for-displaying-png#47231</guid>
  </item> 
  <item>
   <title><![CDATA[CJ Control for displaying .png : Hi,  Whats the best control...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=13826&amp;PID=47217&amp;title=cj-control-for-displaying-png#47217</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=5059">doinIT</a><br /><strong>Subject:</strong> 13826<br /><strong>Posted:</strong> 27 March 2009 at 2:46am<br /><br />Hi,<DIV>&nbsp;</DIV><DIV>Whats the best control to use for displaying a transparent .png file over top of a background image.</DIV><DIV>&nbsp;</DIV><DIV>I paint a custom .png file to the background of a dialog inside onpaint and have successfully used the <FONT size=2>OnCtlColor routine to return the correct brush to make the CJ buttons transparent, but I'd like to know the best control to paint a transparent image.</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV>I've tried using the standard MFC CStatic class, but the transparency isn't working with CStatic::SetBitmap</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2>Thanks,</FONT></DIV><DIV><FONT size=2></FONT>&nbsp;</DIV><DIV><FONT size=2>Jai</FONT></DIV><DIV><FONT size=2></FONT><FONT size=2>&nbsp;</DIV></FONT>]]>
   </description>
   <pubDate>Fri, 27 Mar 2009 02:46:50 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=13826&amp;PID=47217&amp;title=cj-control-for-displaying-png#47217</guid>
  </item> 
 </channel>
</rss>