<?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 : MFC. New Custom Control</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Articles and Tutorials : MFC. New Custom Control]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 16 Apr 2026 19:17:49 +0000</pubDate>
  <lastBuildDate>Mon, 21 Mar 2011 02:48:27 +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=18079</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[MFC. New Custom Control :  CommandBars provides a lot of...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=18079&amp;PID=63405&amp;title=mfc-new-custom-control#63405</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 18079<br /><strong>Posted:</strong> 21 March 2011 at 2:48am<br /><br /><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black">CommandBars provides a lot of standard controls for CommandBars -buttons, popups, edit, combobox, scrollbar, slider, but we always can createown controls derived from one of them.<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black">This article describes how to create control derived from buttonand add some functionality for it.<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black">Let’s create CommandBars button that show active palette color.<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black">1. Create new project using ToolkitPro Appwizard with MenuBar andToolbars.<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black">2. Create new class derived from CXTPControlButton (orCXTPControlPopup for popup button)<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-no-proof:yes">class</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"> <span style="color:#010001">CColorButton</span> : <span style="color:blue">public</span><span style="color:#010001">CXTPControlButton<o:p></o:p></span></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes">{<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-no-proof:yes">public</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes">:<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">CColorButton</span>(<span style="color:blue">void</span>);<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>~<span style="color:#010001">CColorButton</span>(<span style="color:blue">void</span>);<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes">};<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:.75pt;line-height:normal;:  white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="">We need allow our button to save/restore self so need to add<o:p></o:p></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;color:#010001;mso-no-proof:yes">DECLARE_XTP_CONTROL</span><span style="font-size:10.0pt;line-height:115%;font-family:&quot;Courier New&quot;;mso-no-proof:  yes">(<span style="color:#010001">CColorButton</span>), <o:p></o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;color:#010001;mso-no-proof:yes">IMPLEMENT_XTP_CONTROL</span><span style="font-size:10.0pt;line-height:115%;font-family:&quot;Courier New&quot;;mso-no-proof:  yes">(<span style="color:#010001">CColorButton</span>, <span style="color:#010001">CXTPControlButton)macros<o:p></o:p></span></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:&quot;Courier New&quot;;mso-no-proof:  yes"><span style="color:#010001"><br></span></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black">3. Add COLORREF m_clr variable that will be used to draw buttoncontent and add Get and Set methods<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue">void</span> <span style="color:#010001">SetColor</span>(<span style="color:#010001">COLORREF</span> <span style="color:#010001">clr</span>) {<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue">if</span> (<span style="color:#010001">clr</span> != <span style="color:#010001">m_clr</span>) {<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">m_clr</span> = <span style="color:#010001">clr</span>;<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">RedrawParent</span>();<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">COLORREF</span> <span style="color:#010001">GetColor</span>() <span style="color:blue">const</span> {<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue">return</span> <span style="color:#010001">m_clr</span>;<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;  mso-no-proof:yes"><span style="mso-tab-count:1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}</span><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;mso-fareast-font-family:  &quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;color:black"><o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;:white"><span style="font-size:9.0pt;font-family:&quot;Verdana&quot;,&quot;sans-serif&quot;;  mso-fareast-font-family:&quot;Times New Roman&quot;;mso-bidi-font-family:&quot;Times New Roman&quot;;  color:black"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="">4. Override Draw Method and fill rectangle with m_clr color<o:p></o:p></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue">virtual</span> <span style="color:  blue">void</span> <span style="color:#010001">Draw</span>(<span style="color:#010001">CDC</span>* <span style="color:#010001">pDC</span>) {<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">GetPaintManager</span>()-&gt;<span style="color:#010001">DrawRectangle</span>(<span style="color:#010001">pDC</span>,<span style="color:#010001">GetRect</span>(), <span style="color:#010001">GetSelected</span>(),<span style="color:#010001">GetPressed</span>(), <o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  3">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">GetEnabled</span>(), <span style="color:#010001">GetChecked</span>(), <span style="color:#010001">GetPopuped</span>(),<span style="color:#010001">m_pParent</span>-&gt;<span style="color:#010001">GetType</span>(),<span style="color:#010001">m_pParent</span>-&gt;<span style="color:#010001">GetPosition</span>());<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">CRect</span> <span style="color:#010001">rcFill</span>(<span style="color:#010001">GetRect</span>());<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">rcFill</span>.<span style="color:#010001">DeflateRect</span>(3, 3);<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">pDC</span>-&gt;<span style="color:#010001">FillSolidRect</span>(<span style="color:#010001">rcFill</span>,<span style="color:#010001">m_clr</span>);<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;  margin-left:36.0pt;margin-bottom:.0001pt;text-indent:36.0pt;line-height:normal;  mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:10.0pt;  font-family:&quot;Courier New&quot;;color:#010001;mso-no-proof:yes">pDC</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes">-&gt;<span style="color:#010001">Draw3dRect</span>(<span style="color:#010001">rcFill</span>,0, 0);<o:p></o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;mso-no-proof:yes">5. Now Connect our new button class with buttonof toolbar<o:p></o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;color:#010001;mso-no-proof:yes">ON_XTP_CREATECONTROL</span><span style="font-size:10.0pt;line-height:115%;font-family:&quot;Courier New&quot;;mso-no-proof:  yes">()<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes">…<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;color:blue;mso-no-proof:yes">int</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"> <span style="color:#010001">CMainFrame</span>::<span style="color:#010001">OnCreateControl</span>(<span style="color:#010001">LPCREATECONTROLSTRUCT</span> <span style="color:#010001">lpCreateControl</span>)<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes">{<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue">if</span> (<span style="color:#010001">lpCreateControl</span>-&gt;<span style="color:#010001">nID</span> == <span style="color:#010001">ID_VIEW_COLOR</span>)<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>{<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  2">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:#010001">lpCreateControl</span>-&gt;<span style="color:#010001">pControl</span> = <span style="color:blue">new</span> <span style="color:#010001">CColorButton</span>();<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-top:0cm;margin-right:0cm;margin-bottom:0cm;  margin-left:36.0pt;margin-bottom:.0001pt;text-indent:36.0pt;line-height:normal;  mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:10.0pt;  font-family:&quot;Courier New&quot;;color:blue;mso-no-proof:yes">return</span><span style="font-size:10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"> <span style="color:#010001">TRUE</span>;<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>}<o:p></o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"="" style="margin-bottom:0cm;margin-bottom:.0001pt;line-height:  normal;mso-layout-grid-align:n&#111;ne;text-autospace:n&#111;ne"><span style="font-size:  10.0pt;font-family:&quot;Courier New&quot;;mso-no-proof:yes"><span style="mso-tab-count:  1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span><span style="color:blue">return</span> <span style="color:#010001">FALSE</span>;<o:p></o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;mso-no-proof:yes">}<o:p></o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;mso-no-proof:yes"><o:p>&nbsp;</o:p></span></p><p ="ms&#111;normal"=""><span style="font-size:10.0pt;line-height:115%;font-family:  &quot;Courier New&quot;;mso-no-proof:yes">6. Add Update and Execute handlers in our Viewand we’re done.<o:p></o:p></span></p><p ="ms&#111;normal"=""><font ="apple-style-span"="" face="'Courier New'" size="2"><span ="apple-style-span"="" style="line-height: 14px;"><img src="uploads/37/ColorPopupScreenshot.png" height="284" width="383" border="0" /><br></span></font></p><p ="ms&#111;normal"=""><font ="apple-style-span"="" face="'Courier New'" size="2"><span ="apple-style-span"="" style="line-height: 14px;"><br></span></font></p><p ="ms&#111;normal"=""><font ="apple-style-span"="" face="'Courier New'" size="2"><span ="apple-style-span"="" style="line-height: 14px;">Sample Project:</span></font></p><p ="ms&#111;normal"=""><font ="apple-style-span"="" face="'Courier New'" size="2"><span ="apple-style-span"="" style="line-height: 14px;"><a href="uploads/37/ColorPopupSample.zip" target="_blank">ColorPopupSample.zip</a><br></span></font></p>]]>
   </description>
   <pubDate>Mon, 21 Mar 2011 02:48:27 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=18079&amp;PID=63405&amp;title=mfc-new-custom-control#63405</guid>
  </item> 
 </channel>
</rss>