<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Ownerdrawn Button, ABER XP-Stil!]]></title><description><![CDATA[<p>Hi, ich programmiere für mein Programm gerade einen Ownerdrawn Button. Ich habe es schon soweit geschafft, dass er aussieht, wie ein Win95 Button, also dieser alte Stil. Ich möchte ihn aber im XP-Stil haben, also diese orangene, leuchtene, wenn man auf den Button kommt und das blaue wenn man klickt. Gibts dafür irgendwelche Ressourcen oder muss ich mir diesen Effekt als Bitmap drüberzeichnen?</p>
<p>Hier mein Code:</p>
<pre><code class="language-cpp">lpdis = (LPDRAWITEMSTRUCT)lParam;
HDC hMenuDC = CreateCompatibleDC(lpdis-&gt;hDC);
if(lpdis-&gt;CtlID == 4)
{
	SIZE size;
	GetTextExtentPoint32(lpdis-&gt;hDC, &quot;Ownerdraw&quot;, strlen(&quot;Ownerdraw&quot;), &amp;size); 
        SetBkColor(lpdis-&gt;hDC, RGB(244, 244, 240));
        SetTextColor(lpdis-&gt;hDC, RGB(0, 0, 0));
	ExtTextOut(lpdis-&gt;hDC, ((lpdis-&gt;rcItem.right - lpdis-&gt;rcItem.left) - size.cx) / 2, ((lpdis-&gt;rcItem.bottom - lpdis-&gt;rcItem.top) - size.cy) / 2, ETO_OPAQUE | ETO_CLIPPED, &amp;lpdis-&gt;rcItem, Ownerdraw, strlen(Ownerdraw), NULL);

	DrawEdge(lpdis-&gt;hDC, &amp;lpdis-&gt;rcItem, (lpdis-&gt;itemState &amp; ODS_SELECTED ? EDGE_SUNKEN : EDGE_RAISED ), BF_RECT);
}
</code></pre>
<p>€dit: Falls ihr euch fragt, warum Ownerdrawn XP-Button, wenn du nich gleich XP-Buttons benutzt?<br />
Antwort: Ich möchte da ein Bitmap draufzeichnen und wie bekannt ist, wird der Button ja Win95 Stil, wenn man das mit der Bitmap-Methode versucht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/topic/202544/ownerdrawn-button-aber-xp-stil</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 12:58:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/202544.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 12 Jan 2008 18:58:13 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Sat, 12 Jan 2008 19:02:33 GMT]]></title><description><![CDATA[<p>Hi, ich programmiere für mein Programm gerade einen Ownerdrawn Button. Ich habe es schon soweit geschafft, dass er aussieht, wie ein Win95 Button, also dieser alte Stil. Ich möchte ihn aber im XP-Stil haben, also diese orangene, leuchtene, wenn man auf den Button kommt und das blaue wenn man klickt. Gibts dafür irgendwelche Ressourcen oder muss ich mir diesen Effekt als Bitmap drüberzeichnen?</p>
<p>Hier mein Code:</p>
<pre><code class="language-cpp">lpdis = (LPDRAWITEMSTRUCT)lParam;
HDC hMenuDC = CreateCompatibleDC(lpdis-&gt;hDC);
if(lpdis-&gt;CtlID == 4)
{
	SIZE size;
	GetTextExtentPoint32(lpdis-&gt;hDC, &quot;Ownerdraw&quot;, strlen(&quot;Ownerdraw&quot;), &amp;size); 
        SetBkColor(lpdis-&gt;hDC, RGB(244, 244, 240));
        SetTextColor(lpdis-&gt;hDC, RGB(0, 0, 0));
	ExtTextOut(lpdis-&gt;hDC, ((lpdis-&gt;rcItem.right - lpdis-&gt;rcItem.left) - size.cx) / 2, ((lpdis-&gt;rcItem.bottom - lpdis-&gt;rcItem.top) - size.cy) / 2, ETO_OPAQUE | ETO_CLIPPED, &amp;lpdis-&gt;rcItem, Ownerdraw, strlen(Ownerdraw), NULL);

	DrawEdge(lpdis-&gt;hDC, &amp;lpdis-&gt;rcItem, (lpdis-&gt;itemState &amp; ODS_SELECTED ? EDGE_SUNKEN : EDGE_RAISED ), BF_RECT);
}
</code></pre>
<p>€dit: Falls ihr euch fragt, warum Ownerdrawn XP-Button, wenn du nich gleich XP-Buttons benutzt?<br />
Antwort: Ich möchte da ein Bitmap draufzeichnen und wie bekannt ist, wird der Button ja Win95 Stil, wenn man das mit der Bitmap-Methode versucht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1435576</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1435576</guid><dc:creator><![CDATA[Nolf]]></dc:creator><pubDate>Sat, 12 Jan 2008 19:02:33 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Sat, 12 Jan 2008 21:50:54 GMT]]></title><description><![CDATA[<p><a href="http://msdn2.microsoft.com/en-us/library/bb759878(VS.85).aspx" rel="nofollow">http://msdn2.microsoft.com/en-us/library/bb759878(VS.85).aspx</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1435661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1435661</guid><dc:creator><![CDATA[geeky]]></dc:creator><pubDate>Sat, 12 Jan 2008 21:50:54 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Thu, 17 Jan 2008 18:39:52 GMT]]></title><description><![CDATA[<p>OK das ist sehr gut! <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /><br />
Aber dazu habe ich eine Frage und zwar, wie ich es hinkriegen kann, dass wenn der Mauszeiger über den Button geht, dass der &quot;Hot&quot; wird.</p>
<p>Mit den ODS Styles der DRAWITEMSTRUCT -&gt; itemState läuft es nicht.</p>
<p>Muss ich dazu extra eine Mauskoordinatenabfrage schreiben, oder habe ich da einen ODS Style übersehen?</p>
<p>mfg Nolf</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1438596</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438596</guid><dc:creator><![CDATA[Nolf]]></dc:creator><pubDate>Thu, 17 Jan 2008 18:39:52 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Thu, 17 Jan 2008 18:48:40 GMT]]></title><description><![CDATA[<p>für Buttons gibt es den State PBS_HOT, den musst du verwenden, wenn er hot dargestellt werden soll.</p>
<p>ich habe aber meinen Button komplett selbst geschrieben (also nicht den Standard-Button auf Owner-Draw gesetzt) und dann musste ich eben auch selbst verarbeiten, ob die Maus über dem Button ist, oder nicht.<br />
daher hatte ich auch alle Informationen, um den State entsprechend mit Werten zu füllen.</p>
<p>bei mir sah das dann so aus:</p>
<pre><code class="language-cpp">size_t cch = strlen(pInfo-&gt;szText);
int iState = 0;
if (pInfo-&gt;bFocus) iState = PBS_DEFAULTED;
if (pInfo-&gt;bMouseOver) iState = PBS_HOT;
if (pInfo-&gt;bPressed) iState = PBS_PRESSED;
if (iState == 0) iState = PBS_NORMAL;
DrawThemeBackground(hTheme, hDC, BP_PUSHBUTTON, iState, &amp;r, NULL);
RECT rcContent;
GetThemeBackgroundContentRect(hTheme, hDC, BP_PUSHBUTTON, iState, &amp;r, &amp;rcContent);
DrawThemeText(hTheme, hDC, BP_PUSHBUTTON, iState, (boost::lexical_cast&lt;std::wstring&gt;(pInfo-&gt;szText)).c_str(), cch, DT_CENTER | DT_VCENTER | DT_SINGLELINE, 0, &amp;rcContent);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1438602</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438602</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Thu, 17 Jan 2008 18:48:40 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Thu, 17 Jan 2008 19:42:40 GMT]]></title><description><![CDATA[<p>Ja, das es PBS_HOT gibt, weis ich ja, aber ich weis halt nicht, wie es möglich ist, das itemState von der DRAWITEMSTRCUT so zu verarbeiten, dass es prüft, ob der Mauszeiger auf dem Button ist.</p>
<p>Mit dem Pressed und dem DEFAULT-State (=Blauer Rahmen) läuft es.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1438638</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438638</guid><dc:creator><![CDATA[Nolf]]></dc:creator><pubDate>Thu, 17 Jan 2008 19:42:40 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Thu, 17 Jan 2008 21:06:07 GMT]]></title><description><![CDATA[<p>wahrscheinlich wirst du dir selber die Koordinaten holen müssen und überprüfen, ob die Maus über deinem Button ist.<br />
ich persönlich hab noch nie OwnerDrawns gemacht...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1438688</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438688</guid><dc:creator><![CDATA[DrakoXP]]></dc:creator><pubDate>Thu, 17 Jan 2008 21:06:07 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Fri, 18 Jan 2008 07:00:33 GMT]]></title><description><![CDATA[<p><a href="http://www.codeproject.com/buttonctrl/nativewin32xpthemes.asp" rel="nofollow">http://www.codeproject.com/buttonctrl/nativewin32xpthemes.asp</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1438773</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1438773</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Fri, 18 Jan 2008 07:00:33 GMT</pubDate></item><item><title><![CDATA[Reply to Ownerdrawn Button, ABER XP-Stil! on Fri, 18 Jan 2008 15:11:30 GMT]]></title><description><![CDATA[<p>OK vielen Dank für eure Antworten <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
<blockquote>
<p>XP users may have noticed that system buttons are highlighted (or tracked) when the mouse is over the button. However, we don't receive any special notification from Windows when a system button is being hot-tracked. For that we need to determine if the mouse has moved over the button.</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1439105</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1439105</guid><dc:creator><![CDATA[Nolf]]></dc:creator><pubDate>Fri, 18 Jan 2008 15:11:30 GMT</pubDate></item></channel></rss>