<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>旌旗博客 &#187; ownerdraw</title>
	<atom:link href="http://rocky.kingtch.com/tag/ownerdraw/feed/" rel="self" type="application/rss+xml" />
	<link>http://rocky.kingtch.com</link>
	<description></description>
	<lastBuildDate>Tue, 14 Feb 2012 12:39:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>OwnerDraw HeaderCtrl</title>
		<link>http://rocky.kingtch.com/2007/01/26/ownerdraw-headerctrl/</link>
		<comments>http://rocky.kingtch.com/2007/01/26/ownerdraw-headerctrl/#comments</comments>
		<pubDate>Fri, 26 Jan 2007 04:32:04 +0000</pubDate>
		<dc:creator>rocky</dc:creator>
				<category><![CDATA[I.T.]]></category>
		<category><![CDATA[ownerdraw]]></category>

		<guid isPermaLink="false">http://blog.kingtch.com/2007/01/26/32/ownerdraw-headerctrl.html</guid>
		<description><![CDATA[code.screen, div.codescreen{ font-family: monospace; font-size: 1em; display: block; padding: 10px; border: 1px solid #bbb; background-color: #eee; color: #000; overflow: auto; border-radius: 2.5px; -moz-border-radius: 2.5px; margin: 0.5em 2em; } Although many people don&#8217;t like MFC, sometimes we have to use it. This article presents a sample to describe how to implement height adjustment and owner drawing [...]]]></description>
			<content:encoded><![CDATA[<p>code.screen, div.codescreen{<br />
	font-family: monospace;<br />
	font-size: 1em;<br />
	display: block;<br />
	padding: 10px;<br />
	border: 1px solid #bbb;<br />
	background-color: #eee;<br />
	color: #000;<br />
	overflow: auto;<br />
	border-radius: 2.5px;<br />
	-moz-border-radius: 2.5px;<br />
	margin: 0.5em 2em;<br />
}</p>
<p>Although many people don&#8217;t like MFC, sometimes we have to use it. <a href="/files/uploads/2007/01/ipootao.PNG" target="_new" rel="lightbox[65]"><img src="/files/uploads/2007/01/ipootao.thumbnail.PNG" align="right" border="0"></a>This article presents a sample to describe how to implement height adjustment and owner drawing for HeaderControl of ListControl.&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp; Header file:</p>
<p>&nbsp;</p>
<div class="codescreen">
<pre><span style="color: rgb(0,0,255)">class</span> <span style="color: rgb(0,0,0)">CSkinManager</span>;
<span style="color: rgb(0,0,255)">class</span> <span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span> : <span style="color: rgb(0,0,255)">public</span> <span style="color: rgb(0,0,0)">CHeaderCtrl
</span>{
<span style="color: rgb(0,0,255)">public</span>:
    <span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>();

<span style="color: rgb(0,0,255)">protected</span>:
    <span style="color: rgb(0,0,255)">virtual</span> <span style="color: rgb(0,0,255)">void</span> <span style="color: rgb(0,0,0)">DrawItem</span>(<span style="color: rgb(0,0,0)">LPDRAWITEMSTRUCT</span>);

<span style="color: rgb(0,0,255)">protected</span>:
    <span style="color: rgb(0,128,0)">//{{AFX_MSG(COwnerDrawHeaderCtrl)
</span>    <span style="color: rgb(0,0,0)">afx_msg</span> <span style="color: rgb(0,0,0)">LRESULT</span> <span style="color: rgb(0,0,0)">OnLayout</span>(<span style="color: rgb(0,0,0)">WPARAM</span> <span style="color: rgb(0,0,0)">wParam</span>, <span style="color: rgb(0,0,0)">LPARAM</span> <span style="color: rgb(0,0,0)">lParam</span>);
    <span style="color: rgb(0,0,0)">afx_msg</span> <span style="color: rgb(0,0,255)">void</span> <span style="color: rgb(0,0,0)">OnPaint</span>();
    <span style="color: rgb(0,0,0)">afx_msg</span> <span style="color: rgb(0,0,0)">BOOL</span> <span style="color: rgb(0,0,0)">OnEraseBkgnd</span>(<span style="color: rgb(0,0,0)">CDC</span>* <span style="color: rgb(0,0,0)">pDC</span>);
    <span style="color: rgb(0,128,0)">//}}AFX_MSG
</span>    <span style="color: rgb(0,0,0)">DECLARE_MESSAGE_MAP</span>()

<span style="color: rgb(0,0,255)">private</span>:
    <span style="color: rgb(0,0,0)">CSkinManager</span> &amp;<span style="color: rgb(0,0,0)">m_skinManager</span>;
};</pre>
</div>
<pre>&nbsp;</pre>
<pre>Source file:</pre>
<div class="codescreen">
<pre><span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>::<span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>()
    :<span style="color: rgb(0,0,0)">m_skinManager</span>(<span style="color: rgb(0,0,0)">CPootaoClientService</span>::<span style="color: rgb(0,0,0)">Instance</span>().<span style="color: rgb(0,0,0)">GetSkinManager</span>())
{
};

<span style="color: rgb(0,0,0)">BEGIN_MESSAGE_MAP</span>(<span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>, <span style="color: rgb(0,0,0)">CHeaderCtrl</span>)
    <span style="color: rgb(0,128,0)">//{{AFX_MSG_MAP(COwnerDrawHeaderCtrl)
</span>    <span style="color: rgb(0,0,0)">ON_MESSAGE</span>(<span style="color: rgb(0,0,0)">HDM_LAYOUT</span>, <span style="color: rgb(0,0,0)">OnLayout</span>)
    <span style="color: rgb(0,0,0)">ON_WM_PAINT</span>()
    <span style="color: rgb(0,0,0)">ON_WM_ERASEBKGND</span>()
    <span style="color: rgb(0,128,0)">//}}AFX_MSG_MAP
</span><span style="color: rgb(0,0,0)">END_MESSAGE_MAP</span>()

<span style="color: rgb(0,0,0)">LRESULT</span> <span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>::<span style="color: rgb(0,0,0)">OnLayout</span>( <span style="color: rgb(0,0,0)">WPARAM</span> <span style="color: rgb(0,0,0)">wParam</span>, <span style="color: rgb(0,0,0)">LPARAM</span> <span style="color: rgb(0,0,0)">lParam</span> )
{
    <span style="color: rgb(0,0,0)">HDLAYOUT</span>* <span style="color: rgb(0,0,0)">pLayout</span> = ( <span style="color: rgb(0,0,0)">HDLAYOUT</span>* ) <span style="color: rgb(0,0,0)">lParam</span>; <span style="color: rgb(0,128,0)">// cast the lParam
</span>
    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">hwnd</span> = <span style="color: rgb(0,0,0)">GetSafeHwnd</span> (); <span style="color: rgb(0,128,0)">// populate WINDOWPOS struct
</span>    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">hwndInsertAfter</span> = <span style="color: rgb(0,0,0)">HWND_TOP</span>;
    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">flags</span> = <span style="color: rgb(0,0,0)">SWP_NOACTIVATE</span> | <span style="color: rgb(0,0,0)">SWP_NOZORDER</span> | <span style="color: rgb(0,0,0)">SWP_FRAMECHANGED</span>;

    <span style="color: rgb(0,0,255)">int</span> <span style="color: rgb(0,0,0)">nHdrBottom</span> = <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderBackground</span>.<span style="color: rgb(0,0,0)">cy</span>;

    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">x</span> = <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">prc</span>-&gt;<span style="color: rgb(0,0,0)">left</span>;
    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">y</span> = 0;
    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">cx</span> = <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">prc</span>-&gt;<span style="color: rgb(0,0,0)">right</span> - <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">prc</span>-&gt;<span style="color: rgb(0,0,0)">left</span>;
    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">pwpos</span>-&gt;<span style="color: rgb(0,0,0)">cy</span> = <span style="color: rgb(0,0,0)">nHdrBottom</span>;

    <span style="color: rgb(0,0,0)">pLayout</span>-&gt;<span style="color: rgb(0,0,0)">prc</span>-&gt;<span style="color: rgb(0,0,0)">top</span> = <span style="color: rgb(0,0,0)">nHdrBottom</span>;

    <span style="color: rgb(0,0,255)">return</span> <span style="color: rgb(0,0,0)">TRUE</span>;
}

<span style="color: rgb(0,0,255)">void</span> <span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>::<span style="color: rgb(0,0,0)">DrawItem</span>(<span style="color: rgb(0,0,0)">LPDRAWITEMSTRUCT</span>)
{
}

<span style="color: rgb(0,0,0)">BOOL</span> <span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>::<span style="color: rgb(0,0,0)">OnEraseBkgnd</span>(<span style="color: rgb(0,0,0)">CDC</span>* <span style="color: rgb(0,0,0)">pDC</span>)
{

    <span style="color: rgb(0,0,255)">return</span> <span style="color: rgb(0,0,0)">FALSE</span>;
}

<span style="color: rgb(0,0,255)">void</span> <span style="color: rgb(0,0,0)">COwnerDrawHeaderCtrl</span>::<span style="color: rgb(0,0,0)">OnPaint</span>()
{
    <span style="color: rgb(0,0,0)">CPaintDC</span> <span style="color: rgb(0,0,0)">dc</span>(<span style="color: rgb(0,0,255)">this</span>);

    <span style="color: rgb(0,0,0)">HDC</span> <span style="color: rgb(0,0,0)">dcMem</span> = <span style="color: rgb(0,0,0)">dc</span>.<span style="color: rgb(0,0,0)">m_hDC</span>;

    <span style="color: rgb(0,0,0)">CRect</span> <span style="color: rgb(0,0,0)">rectWindow</span>;
    <span style="color: rgb(0,0,0)">GetClientRect</span>(&amp;<span style="color: rgb(0,0,0)">rectWindow</span>);

    <span style="color: rgb(0,0,0)">HFONT</span> <span style="color: rgb(0,0,0)">hOldFont</span> = (<span style="color: rgb(0,0,0)">HFONT</span>)<span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">GetStockObject</span>(<span style="color: rgb(0,0,0)">DEFAULT_GUI_FONT</span>));

    ::<span style="color: rgb(0,0,0)">SetBkColor</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">GetSysColor</span>(<span style="color: rgb(0,0,0)">COLOR_WINDOW</span>));
    <span style="color: rgb(0,0,0)">SetBkMode</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">TRANSPARENT</span>);

    <span style="color: rgb(0,128,0)">//draw the contents to a memory device context
</span>    <span style="color: rgb(0,0,0)">HDC</span> <span style="color: rgb(0,0,0)">dcMemBk</span> = ::<span style="color: rgb(0,0,0)">CreateCompatibleDC</span>(<span style="color: rgb(0,0,0)">dc</span>.<span style="color: rgb(0,0,0)">m_hDC</span>);
    <span style="color: rgb(0,0,0)">HBITMAP</span> <span style="color: rgb(0,0,0)">hOldBitmapBk</span> = (<span style="color: rgb(0,0,0)">HBITMAP</span>)<span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_hBmpHeaderBackground</span>);

    <span style="color: rgb(0,0,255)">int</span> <span style="color: rgb(0,0,0)">rightMost</span> = 0;
    <span style="color: rgb(0,0,255)">for</span> (<span style="color: rgb(0,0,255)">int</span> <span style="color: rgb(0,0,0)">i</span>=0; <span style="color: rgb(0,0,0)">i</span>&lt;<span style="color: rgb(0,0,0)">GetItemCount</span>(); <span style="color: rgb(0,0,0)">i</span>++)
    {
        <span style="color: rgb(0,0,0)">HDITEM</span> <span style="color: rgb(0,0,0)">hdi</span>;
        <span style="color: rgb(0,0,0)">TCHAR</span>  <span style="color: rgb(0,0,0)">lpBuffer</span>[256];

        <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">mask</span> = <span style="color: rgb(0,0,0)">HDI_TEXT</span> | <span style="color: rgb(0,0,0)">HDI_FORMAT</span> | <span style="color: rgb(0,0,0)">HDI_IMAGE</span> | <span style="color: rgb(0,0,0)">HDI_ORDER</span>;
        <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">pszText</span> = <span style="color: rgb(0,0,0)">lpBuffer</span>;
        <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">cchTextMax</span> = 256;

        <span style="color: rgb(0,0,0)">GetItem</span>(<span style="color: rgb(0,0,0)">i</span>, &amp;<span style="color: rgb(0,0,0)">hdi</span>);

        <span style="color: rgb(0,0,0)">CRect</span> <span style="color: rgb(0,0,0)">rcItem</span>;
        <span style="color: rgb(0,0,0)">GetItemRect</span>(<span style="color: rgb(0,0,0)">i</span>, &amp;<span style="color: rgb(0,0,0)">rcItem</span>);

        <span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_hBmpHeaderSep</span>);
        <span style="color: rgb(0,0,0)">BitBlt</span>(<span style="color: rgb(0,0,0)">dcMem
</span>            , <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">left</span>, <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">top
</span>            , <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderSep</span>.<span style="color: rgb(0,0,0)">cx</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderSep</span>.<span style="color: rgb(0,0,0)">cy
</span>            , <span style="color: rgb(0,0,0)">dcMemBk</span>, 0, 0, <span style="color: rgb(0,0,0)">SRCCOPY</span>);

        <span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_hBmpHeaderBackground</span>);
        <span style="color: rgb(0,0,0)">StretchBlt</span>(<span style="color: rgb(0,0,0)">dcMem
</span>            , <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">left</span> + 1, <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">top
</span>            , <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">Width</span>()-1, <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">Height</span>()
            , <span style="color: rgb(0,0,0)">dcMemBk
</span>            , 0, 0, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderBackground</span>.<span style="color: rgb(0,0,0)">cx</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderBackground</span>.<span style="color: rgb(0,0,0)">cy
</span>            , <span style="color: rgb(0,0,0)">SRCCOPY</span>);

        <span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_hBmpHeaderSep</span>);
        <span style="color: rgb(0,0,0)">BitBlt</span>(<span style="color: rgb(0,0,0)">dcMem
</span>            , <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">right</span>, <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">top
</span>            , <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderSep</span>.<span style="color: rgb(0,0,0)">cx</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderSep</span>.<span style="color: rgb(0,0,0)">cy
</span>            , <span style="color: rgb(0,0,0)">dcMemBk</span>, 0, 0, <span style="color: rgb(0,0,0)">SRCCOPY</span>);

        <span style="color: rgb(0,0,0)">rightMost</span> = <span style="color: rgb(0,0,0)">max</span>(<span style="color: rgb(0,0,0)">rightMost</span>, <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">right</span>);

        <span style="color: rgb(0,0,0)">DRAWITEMSTRUCT</span> <span style="color: rgb(0,0,0)">DrawItemStruct</span>;
        <span style="color: rgb(0,0,0)">GetItemRect</span>(<span style="color: rgb(0,0,0)">i</span>, &amp;<span style="color: rgb(0,0,0)">rcItem</span>);

        <span style="color: rgb(0,0,0)">DrawItemStruct</span>.<span style="color: rgb(0,0,0)">CtlType</span>        = 100;
        <span style="color: rgb(0,0,0)">DrawItemStruct</span>.<span style="color: rgb(0,0,0)">hDC</span>        = <span style="color: rgb(0,0,0)">dc</span>.<span style="color: rgb(0,0,0)">GetSafeHdc</span>();
        <span style="color: rgb(0,0,0)">DrawItemStruct</span>.<span style="color: rgb(0,0,0)">itemAction</span>    = <span style="color: rgb(0,0,0)">ODA_DRAWENTIRE</span>;
        <span style="color: rgb(0,0,0)">DrawItemStruct</span>.<span style="color: rgb(0,0,0)">hwndItem</span>     = <span style="color: rgb(0,0,0)">GetSafeHwnd</span>();
        <span style="color: rgb(0,0,0)">DrawItemStruct</span>.<span style="color: rgb(0,0,0)">rcItem</span>    = <span style="color: rgb(0,0,0)">rcItem</span>;
        <span style="color: rgb(0,0,0)">DrawItemStruct</span>.<span style="color: rgb(0,0,0)">itemID</span>    = <span style="color: rgb(0,0,0)">i</span>;
        <span style="color: rgb(0,0,0)">DrawItem</span>(&amp;<span style="color: rgb(0,0,0)">DrawItemStruct</span>);

        <span style="color: rgb(0,128,0)">// Draw the items text using the text color.
</span>        <span style="color: rgb(0,0,0)">COLORREF</span> <span style="color: rgb(0,0,0)">crOldColor</span> = ::<span style="color: rgb(0,0,0)">SetTextColor</span>(<span style="color: rgb(0,0,0)">dcMem</span>,
            <span style="color: rgb(0,0,0)">RGB</span>(0x4f,0x4f,0x4f));
        <span style="color: rgb(0,0,0)">SetBkMode</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">TRANSPARENT</span>);

        <span style="color: rgb(0,0,0)">UINT</span> <span style="color: rgb(0,0,0)">uFormat</span> = <span style="color: rgb(0,0,0)">DT_SINGLELINE</span>|<span style="color: rgb(0,0,0)">DT_VCENTER</span>|<span style="color: rgb(0,0,0)">DT_NOPREFIX</span>|<span style="color: rgb(0,0,0)">DT_END_ELLIPSIS</span>;
        <span style="color: rgb(0,0,255)">if</span>( <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">fmt</span> &amp; <span style="color: rgb(0,0,0)">HDF_CENTER</span>)
            <span style="color: rgb(0,0,0)">uFormat</span> |= <span style="color: rgb(0,0,0)">DT_CENTER</span>;
        <span style="color: rgb(0,0,255)">else</span> <span style="color: rgb(0,0,255)">if</span>( <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">fmt</span> &amp; <span style="color: rgb(0,0,0)">HDF_RIGHT</span>)
            <span style="color: rgb(0,0,0)">uFormat</span> |= <span style="color: rgb(0,0,0)">DT_RIGHT</span>;
        <span style="color: rgb(0,0,255)">else
</span>            <span style="color: rgb(0,0,0)">uFormat</span> |= <span style="color: rgb(0,0,0)">DT_LEFT</span>;

        <span style="color: rgb(0,0,0)">CRect</span> <span style="color: rgb(0,0,0)">rectText</span>(<span style="color: rgb(0,0,0)">rcItem</span>);
        <span style="color: rgb(0,0,0)">CPoint</span> <span style="color: rgb(0,0,0)">ptImage</span>(0, 0);

        <span style="color: rgb(0,0,0)">CImageList</span> *<span style="color: rgb(0,0,0)">imageList</span> = <span style="color: rgb(0,0,0)">NULL</span>;
        <span style="color: rgb(0,0,255)">if</span> (<span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">fmt</span> &amp; <span style="color: rgb(0,0,0)">HDF_IMAGE</span> &amp;&amp; (<span style="color: rgb(0,0,0)">imageList</span> = <span style="color: rgb(0,0,0)">GetImageList</span>()) != <span style="color: rgb(0,0,0)">NULL</span>)
        {
            <span style="color: rgb(0,0,0)">IMAGEINFO</span> <span style="color: rgb(0,0,0)">imageInfo</span>;
            <span style="color: rgb(0,0,255)">if</span> (<span style="color: rgb(0,0,0)">imageList</span>-&gt;<span style="color: rgb(0,0,0)">GetImageInfo</span>(<span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">iImage</span>, &amp;<span style="color: rgb(0,0,0)">imageInfo</span>))
            {
                <span style="color: rgb(0,0,255)">if</span> (!(<span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">fmt</span> &amp; <span style="color: rgb(0,0,0)">HDF_BITMAP_ON_RIGHT</span>))
                {
                    <span style="color: rgb(0,0,0)">ptImage</span> = <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">TopLeft</span>();
                    <span style="color: rgb(0,0,0)">ptImage</span>.<span style="color: rgb(0,0,0)">x</span> += 4;
                    <span style="color: rgb(0,0,0)">ptImage</span>.<span style="color: rgb(0,0,0)">y</span> = <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">top</span> + (<span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">Height</span>()-(<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">bottom</span>-<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">top</span>))/2;

                    <span style="color: rgb(0,0,0)">imageList</span>-&gt;<span style="color: rgb(0,0,0)">Draw</span>(&amp;<span style="color: rgb(0,0,0)">dc</span>, <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">iImage</span>, <span style="color: rgb(0,0,0)">ptImage</span>, <span style="color: rgb(0,0,0)">ILD_TRANSPARENT</span>);

                    <span style="color: rgb(0,0,0)">rectText</span>.<span style="color: rgb(0,0,0)">left</span> += <span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">right</span>-<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">left</span>+4;
                }
                <span style="color: rgb(0,0,255)">else
</span>                {
                    <span style="color: rgb(0,0,0)">rectText</span>.<span style="color: rgb(0,0,0)">right</span> -= <span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">right</span>-<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">left</span>+4;
                }
            }

            ::<span style="color: rgb(0,0,0)">SetTextColor</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">RGB</span>(0x00,0x00,0x00));
        }

        <span style="color: rgb(0,0,0)">rectText</span>.<span style="color: rgb(0,0,0)">DeflateRect</span>(4, 2, 4, 2);
        <span style="color: rgb(0,0,255)">int</span> <span style="color: rgb(0,0,0)">nTextSize</span> = ::<span style="color: rgb(0,0,0)">DrawText</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">lpBuffer</span>, <span style="color: rgb(0,0,0)">lstrlen</span>(<span style="color: rgb(0,0,0)">lpBuffer</span>), &amp;<span style="color: rgb(0,0,0)">rectText</span>, <span style="color: rgb(0,0,0)">uFormat</span>);
        ::<span style="color: rgb(0,0,0)">SetTextColor</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">crOldColor</span>);

        <span style="color: rgb(0,0,255)">if</span> (<span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">fmt</span> &amp; <span style="color: rgb(0,0,0)">HDF_IMAGE</span> &amp;&amp; <span style="color: rgb(0,0,0)">imageList</span> != <span style="color: rgb(0,0,0)">NULL</span>)
        {
            <span style="color: rgb(0,0,0)">IMAGEINFO</span> <span style="color: rgb(0,0,0)">imageInfo</span>;
            <span style="color: rgb(0,0,255)">if</span> (<span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">fmt</span> &amp; <span style="color: rgb(0,0,0)">HDF_BITMAP_ON_RIGHT
</span>                &amp;&amp; <span style="color: rgb(0,0,0)">imageList</span>-&gt;<span style="color: rgb(0,0,0)">GetImageInfo</span>(<span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">iImage</span>, &amp;<span style="color: rgb(0,0,0)">imageInfo</span>))
            {
                <span style="color: rgb(0,0,0)">CSize</span> <span style="color: rgb(0,0,0)">sizeText</span>;
                <span style="color: rgb(0,0,0)">GetTextExtentPoint</span>(<span style="color: rgb(0,0,0)">dcMem</span>, <span style="color: rgb(0,0,0)">lpBuffer</span>, <span style="color: rgb(0,0,0)">lstrlen</span>(<span style="color: rgb(0,0,0)">lpBuffer</span>), &amp;<span style="color: rgb(0,0,0)">sizeText</span>);
                <span style="color: rgb(0,0,0)">ptImage</span> = <span style="color: rgb(0,0,0)">CPoint</span>(<span style="color: rgb(0,0,0)">min</span>(<span style="color: rgb(0,0,0)">rectText</span>.<span style="color: rgb(0,0,0)">right</span> + <span style="color: rgb(0,0,0)">sizeText</span>.<span style="color: rgb(0,0,0)">cx</span> + 16, <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">left</span> + <span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">Width</span>()-(<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">right</span>-<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">left</span>)-4)
                    , (<span style="color: rgb(0,0,0)">rcItem</span>.<span style="color: rgb(0,0,0)">Height</span>()-(<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">bottom</span>-<span style="color: rgb(0,0,0)">imageInfo</span>.<span style="color: rgb(0,0,0)">rcImage</span>.<span style="color: rgb(0,0,0)">top</span>))/2);

                <span style="color: rgb(0,0,0)">imageList</span>-&gt;<span style="color: rgb(0,0,0)">Draw</span>(&amp;<span style="color: rgb(0,0,0)">dc</span>, <span style="color: rgb(0,0,0)">hdi</span>.<span style="color: rgb(0,0,0)">iImage</span>, <span style="color: rgb(0,0,0)">ptImage</span>, <span style="color: rgb(0,0,0)">ILD_TRANSPARENT</span>);
            }
        }
    }

    <span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_hBmpHeaderBackground</span>);
    <span style="color: rgb(0,0,0)">StretchBlt</span>(<span style="color: rgb(0,0,0)">dcMem
</span>        , <span style="color: rgb(0,0,0)">rightMost</span>+1, 0
        , <span style="color: rgb(0,0,0)">rectWindow</span>.<span style="color: rgb(0,0,0)">Width</span>()-<span style="color: rgb(0,0,0)">rightMost</span>-1, <span style="color: rgb(0,0,0)">rectWindow</span>.<span style="color: rgb(0,0,0)">Height</span>()
        , <span style="color: rgb(0,0,0)">dcMemBk
</span>        , 0, 0, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderBackground</span>.<span style="color: rgb(0,0,0)">cx</span>, <span style="color: rgb(0,0,0)">m_skinManager</span>.<span style="color: rgb(0,0,0)">m_sizeHeaderBackground</span>.<span style="color: rgb(0,0,0)">cy
</span>        , <span style="color: rgb(0,0,0)">SRCCOPY</span>);

    <span style="color: rgb(0,0,0)">SelectObject</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>, <span style="color: rgb(0,0,0)">hOldBitmapBk</span>);
    <span style="color: rgb(0,0,0)">DeleteDC</span>(<span style="color: rgb(0,0,0)">dcMemBk</span>);
}
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://rocky.kingtch.com/2007/01/26/ownerdraw-headerctrl/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

