<?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[Text in Static Textfeld um x Pixel nach unternverschieben]]></title><description><![CDATA[<p>Hi, wie schon im Titel erwähnt, möchte ich meinen Text um x Pixel nach unten verschieben.</p>
<p>Den Text des Fensters setzte ich zur Zeit mit:</p>
<pre><code class="language-cpp">...
SetWindowText(hwndStaticHead[0], sz);
SendMessage(hwndStaticHead[0], WM_SETFONT, (WPARAM) hFontS11B, MAKELPARAM(1, 0));
...
</code></pre>
<p>Das klappt auch wunderbar. Jetzt würd ich gerne nur noch, dass ich den Text nicht oben im Fenster stehen hab, sondern ein paar Pixel weiter unten.</p>
<p>Das Fenster wird so erstellt:</p>
<pre><code class="language-cpp">...
hwndStaticHead[0]  = CreateWindow(TEXT(&quot;static&quot;), &quot;&quot;, WS_CHILD | WS_VISIBLE, 0,  0, 500, 20, hwnd, 0, hInstance, NULL);
...
</code></pre>
<p>Gibt es vielleicht bei WS_CHILD | WS_VISIBLE noch ein Zusatz der den Text unten im Fenster anordnet, welchen ich dann übersehen hab <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>
<p>Oder kennt jemand vielleicht eine andere Möglichkeit?</p>
<p>Vielen Dank schonmal <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>
]]></description><link>https://www.c-plusplus.net/forum/topic/179114/text-in-static-textfeld-um-x-pixel-nach-unternverschieben</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Jul 2026 03:09:29 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/179114.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 18 Apr 2007 16:19:34 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 16:19:34 GMT]]></title><description><![CDATA[<p>Hi, wie schon im Titel erwähnt, möchte ich meinen Text um x Pixel nach unten verschieben.</p>
<p>Den Text des Fensters setzte ich zur Zeit mit:</p>
<pre><code class="language-cpp">...
SetWindowText(hwndStaticHead[0], sz);
SendMessage(hwndStaticHead[0], WM_SETFONT, (WPARAM) hFontS11B, MAKELPARAM(1, 0));
...
</code></pre>
<p>Das klappt auch wunderbar. Jetzt würd ich gerne nur noch, dass ich den Text nicht oben im Fenster stehen hab, sondern ein paar Pixel weiter unten.</p>
<p>Das Fenster wird so erstellt:</p>
<pre><code class="language-cpp">...
hwndStaticHead[0]  = CreateWindow(TEXT(&quot;static&quot;), &quot;&quot;, WS_CHILD | WS_VISIBLE, 0,  0, 500, 20, hwnd, 0, hInstance, NULL);
...
</code></pre>
<p>Gibt es vielleicht bei WS_CHILD | WS_VISIBLE noch ein Zusatz der den Text unten im Fenster anordnet, welchen ich dann übersehen hab <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>
<p>Oder kennt jemand vielleicht eine andere Möglichkeit?</p>
<p>Vielen Dank schonmal <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>
]]></description><link>https://www.c-plusplus.net/forum/post/1268630</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268630</guid><dc:creator><![CDATA[Compufreak*C++*]]></dc:creator><pubDate>Wed, 18 Apr 2007 16:19:34 GMT</pubDate></item><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 16:56:31 GMT]]></title><description><![CDATA[<p>Also Du kannst die Textposition nicht frei wählen, sondern musst Dich auf ein paar Flags beschränken: <a href="http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/staticcontrols/staticcontrolreference/staticcontrolstyles.asp" rel="nofollow">Static Control Styles</a> (siehe dort beispielsweise SS_CENTER etc., diese werden beim Aufruf von CreateWindow(Ex) als Style-Flag mit angegeben). Wenn Dir das nicht reicht, musst Du das Control via Ownerdraw selbst zeichnen (siehe Google, Forumsuche, ...).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1268648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268648</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 18 Apr 2007 16:56:31 GMT</pubDate></item><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 17:22:23 GMT]]></title><description><![CDATA[<blockquote>
<p>Also Du kannst die Textposition nicht frei wählen, sondern musst Dich auf ein paar Flags beschränken: Static Control Styles (siehe dort beispielsweise SS_CENTER etc., diese werden beim Aufruf von CreateWindow(Ex) als Style-Flag mit angegeben). Wenn Dir das nicht reicht, musst Du das Control via Ownerdraw selbst zeichnen (siehe Google, Forumsuche, ...).</p>
</blockquote>
<p>Sowas hatte ich mir fast schon gedacht, naja dann muss ich das wohl mal selbst versuchen zu zeichnen.<br />
Danke für die schnelle Antwort, hier gehts ja echt schnell *freu*.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1268659</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268659</guid><dc:creator><![CDATA[Compufreak*C++*]]></dc:creator><pubDate>Wed, 18 Apr 2007 17:22:23 GMT</pubDate></item><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 17:28:31 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">...
case WM_PAINT:
hdc = BeginPaint(hwnd, &amp;ps);
GetWindowRect(hwnd, RectWnd);
hdcMem = CreateCompatibleDC(hdc);
hBitmapTrans = CreateCompatibleBitmap(hdc, RectWnd-&gt;right - RectWnd-&gt;left, RectWnd-&gt;bottom - RectWnd-&gt;top);
GetObject(hBitmapTrans, sizeof (BITMAP), &amp;bitmap);
cxSource = bitmap.bmWidth;
cySource = bitmap.bmHeight;
SelectObject(hdcMem, hBitmapTrans);
BitBlt (hdc, 0, 1, cxSource, cySource, hdcMem, 0, 0, SRCCOPY);
DeleteDC(hdcMem);
EndPaint(hwnd, &amp;ps);
IsDraw = FALSE;
break;
...
</code></pre>
<p>hwnd ist das Fenster. Ich hätte gedacht, das ich damit den Inhalt &quot;abfotografiere&quot; und 1 Pixel nach untenschiebe. Aber irgendwie wird das Fenster nur schwarz. Kann mir jemand sagen, was falsch ist, bzw. wo mein Denkfehler liegt?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1268668</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268668</guid><dc:creator><![CDATA[Compufreak*C++*]]></dc:creator><pubDate>Wed, 18 Apr 2007 17:28:31 GMT</pubDate></item><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 17:33:40 GMT]]></title><description><![CDATA[<p>Compufreak[C++] schrieb:</p>
<blockquote>
<p>hwnd ist das Fenster. Ich hätte gedacht, das ich damit den Inhalt &quot;abfotografiere&quot; und 1 Pixel nach untenschiebe. Aber irgendwie wird das Fenster nur schwarz. Kann mir jemand sagen, was falsch ist, bzw. wo mein Denkfehler liegt?</p>
</blockquote>
<p>Ne. Du musst das auch auf 'das Control beziehen', d.h. Du musst sublcassen, siehe hier: <a href="http://winapi.net/index.php?inhalt=s27" rel="nofollow">http://winapi.net/index.php?inhalt=s27</a><br />
(Oder ist das schon der 'Sub-Class-Code' ? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /> &quot;hwnd ist das Fenster.&quot; ist etwas ungenau, welches Fenster denn ? (Parent oder das Static-Fenster))<br />
Du musst ja dann updaten ( <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/27a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--right_arrow"
      title=":arrow_right:"
      alt="➡"
    /> WM_PAINT), wenn es das Static-Control benötigt, nicht das Parent-Fenster.</p>
<p>PS: Man soll das vorherige Objekt, was in einem HDC drin ist, wieder herein selektieren, siehe MSDN-Infos zu SelectObject, in der Remarks-Section. Das hast Du nicht gemacht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1268672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268672</guid><dc:creator><![CDATA[CodeFinder]]></dc:creator><pubDate>Wed, 18 Apr 2007 17:33:40 GMT</pubDate></item><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 17:37:58 GMT]]></title><description><![CDATA[<p>Das ist alles schon Sub-Class-Code, sry war wirklich nicht klar erkenntlich. Ich werd das mal kurz testen. Danke erstmal.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1268677</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268677</guid><dc:creator><![CDATA[Compufreak*C++*]]></dc:creator><pubDate>Wed, 18 Apr 2007 17:37:58 GMT</pubDate></item><item><title><![CDATA[Reply to Text in Static Textfeld um x Pixel nach unternverschieben on Wed, 18 Apr 2007 18:23:51 GMT]]></title><description><![CDATA[<p>Ich glaub die Idee kann ich auch verwerfen, denn irgendwie klappt das nicht richtig.</p>
<p>Mein neuer Code</p>
<pre><code class="language-cpp">hdc = BeginPaint(hwnd, &amp;ps);
GetWindowRect(hwnd, &amp;RectWnd);
hdcMem = CreateCompatibleDC(hdc);
hBitmapTrans = CreateCompatibleBitmap(hdc, RectWnd.right, RectWnd.bottom);
cxSource = RectWnd.right;
cySource = RectWnd.bottom;
hold = SelectObject(hdcMem, hBitmapTrans);
BitBlt (hdcMem, 0, 0, cxSource, cySource, hdc, 0, 0, SRCCOPY);

BitBlt (hdc, 0, 1, cxSource, cySource, hdcMem, 0, 0, SRCCOPY);

SelectObject(hdcMem, hold);
DeleteDC(hdcMem);
EndPaint(hwnd, &amp;ps);
</code></pre>
<p>Wo ist da der Fehler/Denkfehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1268696</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1268696</guid><dc:creator><![CDATA[Compufreak*C++*]]></dc:creator><pubDate>Wed, 18 Apr 2007 18:23:51 GMT</pubDate></item></channel></rss>