<?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 : How to change butt&#111;n image?</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Command Bars : How to change butt&#111;n image?]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Mon, 27 Apr 2026 02:58:14 +0000</pubDate>
  <lastBuildDate>Thu, 10 Aug 2006 06:37:56 +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=909</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[How to change butt&#111;n image? : Try this depending upon the flag...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=14802&amp;title=how-to-change-button-image#14802</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2230">bluesaphire</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 10 August 2006 at 6:37am<br /><br /><P>&nbsp;Try this</P><DIV>depending upon the flag checked or unchecked call the setcustomicon function accordingly</DIV><DIV>if( m_bSingleProduct )<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">pControl-&gt;SetIconId(ID_SINGLE_PRODUCT);</SPAN><BR><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">HICON hIcon; <?:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>hIcon = AfxGetApp()-&gt;LoadIcon(ID_SINGLE_PRODUCT); <o:p></o:p></SPAN></P>&nbsp;&nbsp;<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">pControl-&gt;SetCustomIcon(hIcon);<o:p></o:p></SPAN></DIV><DIV>}<BR>else</DIV><DIV>{</DIV><DIV>&nbsp;&nbsp;<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">pControl-&gt;SetIconId(ID_MULTIPLE_PRODUCT);</SPAN><BR><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">HICON hIcon; <o:p></o:p></SPAN><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'"><SPAN style="mso-spacerun: yes">&nbsp;</SPAN>hIcon = AfxGetApp()-&gt;LoadIcon(ID_MULTIPLE_PRODUCT); <o:p></o:p></SPAN></P>&nbsp;&nbsp;<SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">pControl-&gt;SetCustomIcon(hIcon);<o:p></o:p></SPAN></DIV><DIV>&nbsp;</DIV><DIV>}</DIV><P =Ms&#111;normal style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne"><SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Courier New'">I guess this is what you looking for?</SPAN></P>]]>
   </description>
   <pubDate>Thu, 10 Aug 2006 06:37:56 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=14802&amp;title=how-to-change-button-image#14802</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : List all your code related this...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=4902&amp;title=how-to-change-button-image#4902</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 31 January 2005 at 5:55am<br /><br />List all your code related this problem.]]>
   </description>
   <pubDate>Mon, 31 Jan 2005 05:55:12 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=4902&amp;title=how-to-change-button-image#4902</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : I too would like to see how an...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=4867&amp;title=how-to-change-button-image#4867</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=26">clintsinger</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 27 January 2005 at 5:37pm<br /><br /><P>I too would like to see how an icon is accessed.&nbsp; I have tried to add icon resources and then point the SetIconId to the corresponding resource id but all that happens is that the area on toolbar where the icon should appear is blank</P><P>I am doing the call from an OnUpdate(CCmdUI* pCmdUI) method and calling CXTPControl* pCtl = CXTPControl::FromUI( pCmdUI ) ; to get the control.</P><P>Anyone have any ideas?</P>]]>
   </description>
   <pubDate>Thu, 27 Jan 2005 17:37:03 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=4867&amp;title=how-to-change-button-image#4867</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : I had seen this function but I...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2427&amp;title=how-to-change-button-image#2427</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=491">brianh</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 05 July 2004 at 4:39am<br /><br /><P>I had seen this function but I couldn't see how to add the icons and get their ids in the first place.&nbsp; Can you explain how this is done?</P><P>Thanks</P>]]>
   </description>
   <pubDate>Mon, 05 Jul 2004 04:39:23 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2427&amp;title=how-to-change-button-image#2427</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : Easer way to change IconId of...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2424&amp;title=how-to-change-button-image#2424</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=6851">Oleg</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 05 July 2004 at 3:47am<br /><br /><P>Easer way to change IconId of control:</P><P>pCtl-&gt;SetIconId(m_bSingleProduct? ID_SINGLE_PRODUCT: ID_MULTI_PRODUCT)</P><P>&nbsp;</P>]]>
   </description>
   <pubDate>Mon, 05 Jul 2004 03:47:08 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2424&amp;title=how-to-change-button-image#2424</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : I know why the icon in the menu...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2412&amp;title=how-to-change-button-image#2412</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=491">brianh</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 02 July 2004 at 11:30am<br /><br />I know why the icon in the menu was offset, I was using LoadIcon() to load it and this only loads icons of the default system size so it was enlarging the icon thus causing the alignment problem.&nbsp; I changed this to use LoadImage() and the icon in the menu is now correctly positioned - what's more it changes with the toolbar icon. :)]]>
   </description>
   <pubDate>Fri, 02 Jul 2004 11:30:41 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2412&amp;title=how-to-change-button-image#2412</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : I have managed to solve the problem...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2411&amp;title=how-to-change-button-image#2411</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=491">brianh</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 02 July 2004 at 10:24am<br /><br /><P>I have managed to solve the problem by using the following update handler for the button:</P><P>HICON m_hIconSingleProd ;<BR>HICON m_hIconMultipleProd ;<BR>bool m_bSingleProduct ;</P><P>...</P><P>void CMyClass::OnUpdateSingleProduct(CCmdUI* pCmdUI) <BR>{<BR>&nbsp;&nbsp;&nbsp; pCmdUI-&gt;SetCheck(m_bSingleProduct ? 1 : 0) ;</P><P>&nbsp;CXTPControl* pCtl = CXTPControl::FromUI( pCmdUI ) ;<BR>&nbsp;if ( pCtl )<BR>&nbsp;{<BR>&nbsp;&nbsp;CXTPImageManagerIcon* pImgIcon = pCtl-&gt;GetParent()-&gt;GetImageManager()-&gt;GetImage( ID_SINGLE_PRODUCT ) ;<BR>&nbsp;&nbsp;ASSERT( pImgIcon ) ;<BR>&nbsp;&nbsp;if( m_bSingleProduct )<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pImgIcon-&gt;SetIcon( m_hIconSingleProd ) ;<BR>&nbsp;&nbsp;}<BR>&nbsp;&nbsp;else<BR>&nbsp;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;pImgIcon-&gt;SetIcon( m_hIconMultipleProd ) ;<BR>&nbsp;&nbsp;}<BR>&nbsp;}<BR>}</P><P>Although this works it doesn't seem very efficient, is there a better way?</P><P>Also the image for this command in the menu is now offset upwards from where it should be, any ideas why?</P>]]>
   </description>
   <pubDate>Fri, 02 Jul 2004 10:24:34 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2411&amp;title=how-to-change-button-image#2411</guid>
  </item> 
  <item>
   <title><![CDATA[How to change butt&#111;n image? : I have a command bar button thatcan...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2410&amp;title=how-to-change-button-image#2410</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=491">brianh</a><br /><strong>Subject:</strong> 909<br /><strong>Posted:</strong> 02 July 2004 at 10:00am<br /><br /><P>I have a command bar button that&nbsp;can be toggled on/off and I want to change the button image depending on whether it's checked or not.</P><P>Does anyone know the best way to do this?</P><P>Thanks.</P>]]>
   </description>
   <pubDate>Fri, 02 Jul 2004 10:00:56 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=909&amp;PID=2410&amp;title=how-to-change-button-image#2410</guid>
  </item> 
 </channel>
</rss>