<?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 : Drawing problem</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Toolkit Pro : Drawing problem]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sat, 04 Apr 2026 05:26:19 +0000</pubDate>
  <lastBuildDate>Mon, 07 May 2007 16:06:04 +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=7070</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[Drawing problem : Hi again. I have a new problem...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=7070&amp;PID=22643&amp;title=drawing-problem#22643</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1940">BastianPL</a><br /><strong>Subject:</strong> 7070<br /><strong>Posted:</strong> 07 May 2007 at 4:06pm<br /><br />Hi again. I have a new problem with XTP Controls. I am drawing some images in gallery control on fly. My code is:<DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2><P></FONT><FONT size=1><FONT color=#010001>CBitmap</FONT> <FONT color=#010001>bmpSrc</FONT>;</FONT></P><P><FONT size=1><FONT color=#010001>bmpSrc</FONT>.<FONT color=#010001>Attach</FONT>( <FONT color=#010001>hBitmap</FONT> );</FONT></P><P><FONT size=1><FONT color=#010001>item</FONT>.<FONT color=#010001>pPopupBitmap</FONT>-&gt;<FONT color=#010001>Attach</FONT>( <FONT color=#010001>CXTPImageManager</FONT>::<FONT color=#010001>Create32BPPDIBSection</FONT>( <FONT color=#800000>0</FONT>, <FONT color=#010001>m_nPopupWidth</FONT>, <FONT color=#010001>m_nPopupHeight</FONT> + <FONT color=#010001>m_nCaptionHeight</FONT> ) );</FONT></P><P><FONT size=1><FONT color=#010001>CXTPCompatibleDC</FONT> <FONT color=#010001>dcSrc</FONT>( <FONT color=#800000>0</FONT>, &amp;<FONT color=#010001>bmpSrc</FONT> );</FONT></P><P><FONT size=1><FONT color=#010001>CXTPCompatibleDC</FONT> *<FONT color=#010001>pdcDest</FONT> = <FONT color=#0000ff>new</FONT> <FONT color=#010001>CXTPCompatibleDC</FONT>( <FONT color=#800000>0</FONT>, <FONT color=#010001>item</FONT>.<FONT color=#010001>pPopupBitmap</FONT> );</FONT></P><P><FONT size=1><FONT color=#010001>BITMAP</FONT> <FONT color=#010001>bmpInfo</FONT>;</FONT></P><P><FONT size=1><FONT color=#010001>ZeroMemory</FONT>( &amp;<FONT color=#010001>bmpInfo</FONT>, <FONT color=#0000ff>sizeof</FONT>( <FONT color=#010001>BITMAP</FONT> ) );</FONT></P><P><FONT size=1><FONT color=#010001>bmpSrc</FONT>.<FONT color=#010001>GetBitmap</FONT>( &amp;<FONT color=#010001>bmpInfo</FONT> );</FONT></P><P><FONT size=1><FONT color=#0000ff>int</FONT> <FONT color=#010001>nWidth</FONT> = <FONT color=#010001>bmpInfo</FONT>.<FONT color=#010001>bmWidth</FONT>;</FONT></P><P><FONT size=1><FONT color=#0000ff>int</FONT> <FONT color=#010001>nHeight</FONT> = <FONT color=#010001>bmpInfo</FONT>.<FONT color=#010001>bmHeight</FONT>;</FONT></P><P><FONT size=1><FONT color=#0000ff>if</FONT> ( <FONT color=#010001>nWidth</FONT> &gt; <FONT color=#010001>m_nPopupWidth</FONT> )</FONT></P><P><FONT size=1>{</FONT></P><P><FONT size=1><FONT color=#0000ff>float</FONT> <FONT color=#010001>fAspectRatio</FONT> = (<FONT color=#0000ff>float</FONT>)<FONT color=#010001>nWidth</FONT> / (<FONT color=#0000ff>float</FONT>)<FONT color=#010001>m_nPopupWidth</FONT>;</FONT></P><P><FONT size=1><FONT color=#010001>nWidth</FONT> = <FONT color=#010001>m_nPopupWidth</FONT>;</FONT></P><P><FONT size=1><FONT color=#010001>nHeight</FONT> = (<FONT color=#0000ff>int</FONT>)( ( (<FONT color=#0000ff>float</FONT>)<FONT color=#010001>nHeight</FONT> / <FONT color=#010001>fAspectRatio</FONT> ) + <FONT color=#800000>0.5f</FONT> );</FONT></P><P><FONT size=1>}</FONT></P><P><FONT size=1><FONT color=#0000ff>if</FONT> ( <FONT color=#010001>nHeight</FONT> &gt; <FONT color=#010001>m_nPopupHeight</FONT> )</FONT></P><P><FONT size=1>{</FONT></P><P><FONT size=1><FONT color=#0000ff>float</FONT> <FONT color=#010001>fAspectRatio</FONT> = (<FONT color=#0000ff>float</FONT>)<FONT color=#010001>nHeight</FONT> / (<FONT color=#0000ff>float</FONT>)<FONT color=#010001>m_nPopupHeight</FONT>;</FONT></P><P><FONT size=1><FONT color=#010001>nHeight</FONT> = <FONT color=#010001>m_nPopupHeight</FONT>;</FONT></P><P><FONT size=1><FONT color=#010001>nWidth</FONT> = (<FONT color=#0000ff>int</FONT>)( ( (<FONT color=#0000ff>float</FONT>)<FONT color=#010001>nWidth</FONT> / <FONT color=#010001>fAspectRatio</FONT> ) + <FONT color=#800000>0.5f</FONT> );</FONT></P><P><FONT size=1>}</FONT></P><P><FONT size=1><FONT color=#0000ff>int</FONT> <FONT color=#010001>nX</FONT> = ( <FONT color=#010001>m_nPopupWidth</FONT> - <FONT color=#010001>nWidth</FONT> ) / <FONT color=#800000>2</FONT>;</FONT></P><P><FONT size=1><FONT color=#0000ff>int</FONT> <FONT color=#010001>nY</FONT> = ( <FONT color=#010001>m_nPopupHeight</FONT> - <FONT color=#010001>nHeight</FONT> ) / <FONT color=#800000>2</FONT>;</FONT></P><P><FONT color=#008000><FONT size=1>// clear thumbnail</FONT></P></FONT><P><FONT size=1><FONT color=#010001>pdcDest</FONT>-&gt;<FONT color=#010001>FillSolidRect</FONT>( <FONT color=#800000>0</FONT>, <FONT color=#800000>0</FONT>, <FONT color=#010001>m_nPopupWidth</FONT>, <FONT color=#010001>m_nPopupHeight</FONT>, <FONT color=#010001>RGB</FONT>( <FONT color=#800000>252</FONT>, <FONT color=#800000>252</FONT>, <FONT color=#800000>252</FONT> ) );</FONT></P><P><FONT color=#008000><FONT size=1>// draw thumbnail</FONT></P><P><FONT size=1>// delete pdcDest;</FONT></P><P><FONT size=1>// pdcDest = new CXTPCompatibleDC( NULL, item.pPopupBitmap );</FONT></P></FONT><P><FONT size=1><FONT color=#010001>pdcDest</FONT>-&gt;<FONT color=#010001>SetStretchBltMode</FONT>( <FONT color=#010001>HALFTONE</FONT> );</FONT></P><P><FONT size=1><FONT color=#010001>pdcDest</FONT>-&gt;<FONT color=#010001>StretchBlt</FONT>( <FONT color=#010001>nX</FONT> + <FONT color=#800000>1</FONT>, <FONT color=#010001>nY</FONT> + <FONT color=#800000>1</FONT>, <FONT color=#010001>nWidth</FONT> - <FONT color=#800000>2</FONT>, <FONT color=#010001>nHeight</FONT> - <FONT color=#800000>2</FONT>, &amp;<FONT color=#010001>dcSrc</FONT>, <FONT color=#800000>0</FONT>, <FONT color=#800000>0</FONT>, <FONT color=#010001>bmpInfo</FONT>.<FONT color=#010001>bmWidth</FONT>, <FONT color=#010001>bmpInfo</FONT>.<FONT color=#010001>bmHeight</FONT>, <FONT color=#010001>SRCCOPY</FONT> );</FONT></P><P><FONT color=#008000><FONT size=1>// draw pre-cut paper icon</FONT></P><DIV></FONT><P><FONT size=1><FONT color=#010001>ImagePreCutPaper</FONT>.<FONT color=#010001>DrawImage</FONT>( <FONT color=#010001>pdcDest</FONT>, <FONT color=#010001>nWidth</FONT> - <FONT color=#800000>64</FONT>, <FONT color=#010001>nHeight</FONT> - <FONT color=#800000>38</FONT>, <FONT color=#800000>64</FONT>, <FONT color=#800000>38</FONT> );</P><DIV></FONT>&nbsp;</DIV><DIV>ImagePreCutPaper.DrawImage has following body:</DIV><DIV>&nbsp;</DIV><DIV><P><FONT size=1><FONT color=#010001>ASSERT</FONT>( <FONT color=#010001>pDC</FONT> != <FONT color=#010001>NULL</FONT> );</FONT></P><P><FONT size=1><FONT color=#010001>ASSERT</FONT>( <FONT color=#010001>m_hBitmap</FONT> != <FONT color=#010001>NULL</FONT> );</FONT></P><P><FONT color=#008000><FONT size=1>// draw bitmap</FONT></P></FONT><P><FONT size=1><FONT color=#010001>CXTPImageManagerIcon</FONT>::<FONT color=#010001>DrawAlphaBitmap</FONT>( <FONT color=#010001>pDC</FONT>, <FONT color=#010001>m_hBitmap</FONT>, <FONT color=#010001>CPoint</FONT>( <FONT color=#010001>nX</FONT>, <FONT color=#010001>nY</FONT> ), <FONT color=#010001>CSize</FONT>( <FONT color=#010001>nWidth</FONT>, <FONT color=#010001>nHeight</FONT> ), <FONT color=#010001>CPoint</FONT>( <FONT color=#800000>0</FONT>, <FONT color=#800000>0</FONT> ), <FONT color=#010001>GetImageSize</FONT>() );</FONT></P></DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Unfortunettly when i call this line my oryginal image disappears i see only new image but in fact i want to draw this new image over old image.</DIV><DIV>Everything works fine until I call this line.</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Thanks for any help</DIV></DIV></DIV>]]>
   </description>
   <pubDate>Mon, 07 May 2007 16:06:04 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=7070&amp;PID=22643&amp;title=drawing-problem#22643</guid>
  </item> 
 </channel>
</rss>