<?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 : CXTPPropertyGridItem colors</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Property Grid : CXTPPropertyGridItem colors]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Sun, 19 Apr 2026 10:43:20 +0000</pubDate>
  <lastBuildDate>Tue, 07 Jun 2005 19:48:45 +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=2213</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[CXTPPropertyGridItem colors : Now that I&amp;#039;ve coughed up...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6927&amp;title=cxtppropertygriditem-colors#6927</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1202">CGrant</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 07 June 2005 at 7:48pm<br /><br /><P>Now that I've coughed up the price of the MFC version of PropertyGrid I've got the sources <IMG src="http://forum.codejock.com/smileys/smiley4.gif" border="0">, so I've revisited it to see if it would be easy enough to change the base class to get grid items coloured.</P><P>I fell foul of include ordering so I opted for this slightly odd approach: I added a virtual method to the class <FONT color=#0000ff>CXTPPropertyGridItem<FONT color=#000000> to get the background colour for that item.</FONT></FONT></P><P><FONT color=#0000ff><FONT color=#000000><table width="99%"><tr><td><pre class="BBcode"><BR></FONT></FONT><FONT color=#0000ff><FONT color=#0000ff>virtual</FONT> <FONT color=#0000ff>void</FONT> <FONT color=#880000>GetBackgroundColour</FONT>(<FONT color=#0000ff>COLORREF</FONT> &amp; <FONT color=#808080>clr</FONT>) { }<BR><FONT color=#000000></pre></td></tr></table></FONT></P><P><FONT color=#000000>and changed the <FONT color=#0000ff>CXTPPropertyGridPaintManager</FONT>::<FONT color=#808080>DrawItem </FONT>to use that colour</FONT></P><P><FONT color=#000000><table width="99%"><tr><td><pre class="BBcode"><BR></FONT><FONT color=#000000><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; COLORREF</FONT> <FONT color=#808080>clrWindow</FONT> = <FONT color=#808080>pView</FONT>-&gt;<FONT color=#808080>m_clrBack</FONT>;&nbsp;&nbsp; &lt;-- existing line<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp; pItem</FONT>-&gt;<FONT color=#880000>GetBackgroundColour</FONT>(<FONT color=#808080>clrWindow</FONT>);&nbsp;&nbsp;&nbsp; &lt;--- added line<BR></pre></td></tr></table></FONT></P><P><FONT color=#000000>That meant that nothing changed until I had my own class <FONT color=#0000ff>RangeCheckedGridItemNumber</FONT>&nbsp;derived <FONT color=#0000ff>CXTPPropertyGridItemNumber </FONT>from that overrode the&nbsp; mehtod</FONT></P><P><FONT color=#000000><table width="99%"><tr><td><pre class="BBcode"><BR><FONT color=#0000ff>void</FONT> <FONT color=#0000ff>RangeCheckedGridItemNumber</FONT>::<FONT color=#880000>GetBackgroundColour</FONT>(<FONT color=#0000ff>COLORREF</FONT> &amp; <FONT color=#808080>clr</FONT>)<BR>{<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp; clr</FONT> = <FONT color=#a000a0>RGB</FONT>(0,255,0);&nbsp; // very green<BR>}<BR></FONT><FONT color=#000000></pre></td></tr></table></FONT></P><P><FONT color=#000000>Obviously you can have any logic you like in your method. I quite like the solution since it is a minimal change, but it does change the library; I hope the next release will have its own SetBackgroundColor() method instead</FONT></P><P><FONT color=#000000>Colin</FONT></P></FONT>]]>
   </description>
   <pubDate>Tue, 07 Jun 2005 19:48:45 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6927&amp;title=cxtppropertygriditem-colors#6927</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : Hi Colin!  Thanx a lot for your...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6854&amp;title=cxtppropertygriditem-colors#6854</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=633">hpesata</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 02 June 2005 at 3:30am<br /><br />Hi Colin!<br><br>Thanx a lot for your detailled support!<br><br>regards,<br>Hans<br><br>]]>
   </description>
   <pubDate>Thu, 02 Jun 2005 03:30:21 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6854&amp;title=cxtppropertygriditem-colors#6854</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors :   hpesata wrote:I am looking...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6849&amp;title=cxtppropertygriditem-colors#6849</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1202">CGrant</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 01 June 2005 at 8:02pm<br /><br /><P><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by hpesata" alt="Originally posted by hpesata" style="vertical-align: text-bottom;" /> <strong>hpesata wrote:</strong><br /><br /><BR>I am looking for a way to also color the item-caption, not only the value.<BR>Do You have any idea on how to do that ?<BR></td></tr></table> </P><P>I had hoped it would be easy but I haven't exactly managed it. The closest I could get involved my own class derived from <FONT color=#0000ff>CXTPPropertyGridPaintManager</FONT> </P><P><table width="99%"><tr><td><pre class="BBcode"><BR><FONT color=#0000ff>class</FONT> <FONT color=#0000ff>CColorItemPaintManager</FONT> : <FONT color=#0000ff>public</FONT> <FONT color=#0000ff>CXTPPropertyGridPaintManager</FONT> <BR>{<BR><FONT color=#0000ff>public</FONT>:<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; CColorItemPaintManager</FONT>(<FONT color=#0000ff>CXTPPropertyGrid</FONT>* <FONT color=#808080>pGrid</FONT>);<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; virtual</FONT> ~<FONT color=#0000ff>CColorItemPaintManager</FONT>();<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; virtual</FONT> <FONT color=#0000ff>void</FONT> <FONT color=#880000>DrawItem</FONT>(<FONT color=#0000ff>PDRAWITEMSTRUCT</FONT> <FONT color=#808080>lpDrawItemStruct</FONT>);<BR>};<BR></pre></td></tr></table></P><P>which I set in to the property grid when I created it</P><P><table width="99%"><tr><td><pre class="BBcode"><BR><FONT color=#0000ff>if</FONT> ( <FONT color=#808080>m_wndPropertyGrid</FONT>.<FONT color=#880000>Create</FONT>( <FONT color=#808080>rc</FONT>, <FONT color=#0000ff>this</FONT>, <FONT color=#a000a0>IDC_PROPERTY_GRID</FONT> ) )<BR>{<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp; m_pPaintManager</FONT> = <FONT color=#a000a0>new</FONT> <FONT color=#0000ff>CColorItemPaintManager</FONT>(&amp;<FONT color=#808080>m_wndPropertyGrid</FONT>);<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp; m_wndPropertyGrid</FONT>.<FONT color=#880000>SetCustomTheme</FONT>(<FONT color=#808080>m_pPaintManager</FONT>);<BR></pre></td></tr></table></P><P>and then, as an example, override <FONT color=#880000>DrawItem </FONT><FONT color=#000000>to splat red down on the selected row.</FONT></P><P><table width="99%"><tr><td><pre class="BBcode"><BR><FONT color=#0000ff>void</FONT> <FONT color=#0000ff>CColorItemPaintManager</FONT>::<FONT color=#880000>DrawItem</FONT>(<FONT color=#0000ff>PDRAWITEMSTRUCT</FONT> <FONT color=#808080>lpDrawItemStruct</FONT>)<BR>{<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; if</FONT> (<FONT color=#a000a0>ODS_SELECTED</FONT> == (<FONT color=#a000a0>ODS_SELECTED</FONT> &amp; <FONT color=#808080>lpDrawItemStruct</FONT>-&gt;<FONT color=#808080>itemState</FONT>))<BR>&nbsp;&nbsp;&nbsp; {<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CRect</FONT> <FONT color=#808080>rc</FONT> = <FONT color=#808080>lpDrawItemStruct</FONT>-&gt;<FONT color=#808080>rcItem</FONT>;<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; CDC</FONT> <FONT color=#808080>dc</FONT>;<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dc</FONT>.<FONT color=#880000>Attach</FONT>(<FONT color=#808080>lpDrawItemStruct</FONT>-&gt;<FONT color=#808080>hDC</FONT>);<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dc</FONT>.<FONT color=#880000>FillSolidRect</FONT>(<FONT color=#808080>rc</FONT>, <FONT color=#a000a0>RGB</FONT>(255,0,0));<BR><FONT color=#808080>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dc</FONT>.<FONT color=#880000>Detach</FONT>();<BR>&nbsp;&nbsp;&nbsp; }<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp; else<BR></FONT>&nbsp;&nbsp;&nbsp; {<BR><FONT color=#0000ff>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CXTPPropertyGridPaintManager</FONT>::<FONT color=#880000>DrawItem</FONT>(<FONT color=#808080>lpDrawItemStruct</FONT>);<BR>&nbsp;&nbsp;&nbsp; }<BR>}<BR></pre></td></tr></table></P><P>The grid item value is still getting painted nicely but the caption is just a solid red rectangle. Filling it in nicely needs a fair bit more work - see Samples\PropertyGrid\OwnerDraw\SimpleGridPage.cpp for its DrawItem code.</P><P>Good luck!</P><P>Colin</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Wed, 01 Jun 2005 20:02:23 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6849&amp;title=cxtppropertygriditem-colors#6849</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : Hi Colin!  thanx for your hint!  I...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6828&amp;title=cxtppropertygriditem-colors#6828</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=633">hpesata</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 31 May 2005 at 3:16am<br /><br />Hi Colin!<br><br>thanx for your hint!<br><br>I am lookong for a way to also color the item-caption, not only the value.<br>Do You have any idea on how to do that ?<br><br>thanx in advance!<br><br>regards,<br>Hans<br><br>]]>
   </description>
   <pubDate>Tue, 31 May 2005 03:16:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6828&amp;title=cxtppropertygriditem-colors#6828</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors :   oleg wrote: You can: 1. Create...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6813&amp;title=cxtppropertygriditem-colors#6813</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1202">CGrant</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 30 May 2005 at 8:59am<br /><br /><table width="99%"><tr><td class="BBquote"><img src="forum_images/quote_box.png" title="Originally posted by oleg" alt="Originally posted by oleg" style="vertical-align: text-bottom;" /> <strong>oleg wrote:</strong><br /><br /><P>You can:</P><P>1. Create custom item inherited from CXTPPropertyGridItem</P><P>2. Override OnDrawItemValue</P><P></td></tr></table> </P><P>I'd also like to see a sinple way to set the background color, but the suggestion worked for me. In my case I wanted a simple valid / invalid coloring of items (numeric items outside a min to max range)</P><P>I always find code examples handy; so I have a class dervied from the ...GridItemNumber that adds range checking by looking at the ::SetValue string to set bool m_valid. The draw override uses it like this:</P><P><table width="99%"><tr><td><pre class="BBcode"></P><P>BOOL RangeCheckedGridItemNumber::OnDrawItemValue(CDC&amp; dc, CRect rcValue)<BR>{<BR>&nbsp;if (!m_valid)<BR>&nbsp;{<BR>&nbsp;&nbsp;// Highlight in red for invalid items<BR>&nbsp;&nbsp;CBrush red(RGB(255,128,128)); <BR>&nbsp;&nbsp;dc.FillRect(rcValue, &amp;red);<BR>&nbsp;}</P><P>&nbsp;return CXTPPropertyGridItemNumber::OnDrawItemValue(dc, rcValue);<BR>}</P><P></pre></td></tr></table></P><P>Keep up the good work</P><P>Colin</P><span style="font-size:10px"><br /><br />Edited by CGrant</span>]]>
   </description>
   <pubDate>Mon, 30 May 2005 08:59:36 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6813&amp;title=cxtppropertygriditem-colors#6813</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : Thanks, that good enough for me! Regards, Kevin. ...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6629&amp;title=cxtppropertygriditem-colors#6629</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1176">Kevin6</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 17 May 2005 at 10:19am<br /><br /><P>Thanks, that good enough for me!</P><P>Regards,</P><P>Kevin.</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Tue, 17 May 2005 10:19:39 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6629&amp;title=cxtppropertygriditem-colors#6629</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : In Summer :) ]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6574&amp;title=cxtppropertygriditem-colors#6574</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 13 May 2005 at 3:18pm<br /><br />In Summer :)]]>
   </description>
   <pubDate>Fri, 13 May 2005 15:18:29 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6574&amp;title=cxtppropertygriditem-colors#6574</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : Thanks Oleg, but you avoided my...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6565&amp;title=cxtppropertygriditem-colors#6565</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1176">Kevin6</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 13 May 2005 at 8:16am<br /><br /><P>Thanks Oleg, but you avoided my other question!</P><P>I have quite a large application to write and could leave the colouring for now and come back to it later. But I would need to know if 10.0 was 3, 6, 12+ months away. Just a general idea would do.</P><P>Regards,</P><P>Kevin.</P><P>&nbsp;</P><P>&nbsp;</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Fri, 13 May 2005 08:16:59 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6565&amp;title=cxtppropertygriditem-colors#6565</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : You can: 1. Create custom item...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6564&amp;title=cxtppropertygriditem-colors#6564</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 13 May 2005 at 8:12am<br /><br /><P>You can:</P><P>1. Create custom item inherited from CXTPPropertyGridItem</P><P>2. Override OnDrawItemValue</P><P>&nbsp;</P><P>or</P><P>&nbsp;</P><P>1 Create custom pain manager inherited from CXTPPropertyGridPaintManager</P><P>2. Override void DrawItem(PDRAWITEMSTRUCT lpDrawItemStruct)<BR></P>]]>
   </description>
   <pubDate>Fri, 13 May 2005 08:12:53 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6564&amp;title=cxtppropertygriditem-colors#6564</guid>
  </item> 
  <item>
   <title><![CDATA[CXTPPropertyGridItem colors : I also have this problem. Is there...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6561&amp;title=cxtppropertygriditem-colors#6561</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=1176">Kevin6</a><br /><strong>Subject:</strong> 2213<br /><strong>Posted:</strong> 13 May 2005 at 7:37am<br /><br /><P>I also have this problem. Is there a work around for now that you can suggest?</P><P>(Also when is the planned release date for 10.0?)</P><P>Regards,</P><P>Kevin.</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Fri, 13 May 2005 07:37:35 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=2213&amp;PID=6561&amp;title=cxtppropertygriditem-colors#6561</guid>
  </item> 
 </channel>
</rss>