<?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[Problem bei der Änderung der Schriftart (Logfont)]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Logfont-Struktur erstellt. Ich kann den Text auch unterstreichen, durchstreichen oder kursiv schreiben, jedoch ist es egal welche Schriftart ich angebe (Arial, Times New Roman,...), die Schrift sieht immer gleich aus.<br />
Jetzt meine Frage, woran liegt das? Was habe ich falsch gemacht? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Hier der Codeausschnitt:</p>
<pre><code class="language-cpp">BOOL SISText::Paint(HDC hdc)
{
	RECT rect;
	LOGFONT font;
	HFONT hFontNew, hFontOld;

	rect.left = 0;
	rect.top = 0;
	rect.right = 100;
	rect.bottom = 200;

	font.lfHeight= -20;
	font.lfWidth=0;
	font.lfEscapement=0;
	font.lfOrientation=0; 
	font.lfWeight=FW_NORMAL;
	font.lfItalic=false;
	font.lfUnderline=false;
	font.lfStrikeOut=false; 
	font.lfCharSet=ANSI_CHARSET; 
	font.lfOutPrecision=OUT_DEFAULT_PRECIS;
	font.lfClipPrecision=CLIP_CHARACTER_PRECIS; 
	font.lfQuality=DEFAULT_QUALITY;
	font.lfPitchAndFamily=FF_DONTCARE; 
	(font.lfFaceName,_T(&quot;Arial&quot;));

	hFontNew = CreateFontIndirect(&amp;font);
	hFontOld = (HFONT) 
	SelectObject(hdc, hFontNew);

	DrawText(hdc, TEXT(&quot;Caption&quot;), -1, &amp;rect, DT_CENTER); 

	return true;
}
</code></pre>
<p>Hoffe, dass ihr mir helfen könnt. Danke schon mal im voraus.<br />
Lg Heike</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/187135/problem-bei-der-änderung-der-schriftart-logfont</link><generator>RSS for Node</generator><lastBuildDate>Sun, 05 Jul 2026 01:36:46 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/187135.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 16 Jul 2007 09:50:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Problem bei der Änderung der Schriftart (Logfont) on Mon, 16 Jul 2007 09:50:00 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich habe eine Logfont-Struktur erstellt. Ich kann den Text auch unterstreichen, durchstreichen oder kursiv schreiben, jedoch ist es egal welche Schriftart ich angebe (Arial, Times New Roman,...), die Schrift sieht immer gleich aus.<br />
Jetzt meine Frage, woran liegt das? Was habe ich falsch gemacht? <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f615.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--confused_face"
      title=":confused:"
      alt="😕"
    /></p>
<p>Hier der Codeausschnitt:</p>
<pre><code class="language-cpp">BOOL SISText::Paint(HDC hdc)
{
	RECT rect;
	LOGFONT font;
	HFONT hFontNew, hFontOld;

	rect.left = 0;
	rect.top = 0;
	rect.right = 100;
	rect.bottom = 200;

	font.lfHeight= -20;
	font.lfWidth=0;
	font.lfEscapement=0;
	font.lfOrientation=0; 
	font.lfWeight=FW_NORMAL;
	font.lfItalic=false;
	font.lfUnderline=false;
	font.lfStrikeOut=false; 
	font.lfCharSet=ANSI_CHARSET; 
	font.lfOutPrecision=OUT_DEFAULT_PRECIS;
	font.lfClipPrecision=CLIP_CHARACTER_PRECIS; 
	font.lfQuality=DEFAULT_QUALITY;
	font.lfPitchAndFamily=FF_DONTCARE; 
	(font.lfFaceName,_T(&quot;Arial&quot;));

	hFontNew = CreateFontIndirect(&amp;font);
	hFontOld = (HFONT) 
	SelectObject(hdc, hFontNew);

	DrawText(hdc, TEXT(&quot;Caption&quot;), -1, &amp;rect, DT_CENTER); 

	return true;
}
</code></pre>
<p>Hoffe, dass ihr mir helfen könnt. Danke schon mal im voraus.<br />
Lg Heike</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1326398</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1326398</guid><dc:creator><![CDATA[Heike711]]></dc:creator><pubDate>Mon, 16 Jul 2007 09:50:00 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei der Änderung der Schriftart (Logfont) on Mon, 16 Jul 2007 10:16:09 GMT]]></title><description><![CDATA[<p>Heike711 schrieb:</p>
<blockquote>
<pre><code class="language-cpp">BOOL SISText::Paint(HDC hdc)
{
...
	(font.lfFaceName,_T(&quot;Arial&quot;));
...
</code></pre>
<p>Hoffe, dass ihr mir helfen könnt. Danke schon mal im voraus.</p>
</blockquote>
<p>Hier fehlt en _tcscpy oder _tcsncpy.<br />
Dieses Statement hat keinen Effekt!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1326414</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1326414</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 16 Jul 2007 10:16:09 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei der Änderung der Schriftart (Logfont) on Mon, 16 Jul 2007 11:14:25 GMT]]></title><description><![CDATA[<p>Hi,<br />
danke erstmal für deine schnelle Antwort. Jedoch hab ich leider keine Ahnung wo ich das einfügen muss, bin Anfängerin.</p>
<p>Heike</p>
<p>Habe es jetzt eingefügt. Sieht jetzt so aus:</p>
<pre><code class="language-cpp">wcscpy(font.lfFaceName,_T(&quot;Arial&quot;));
</code></pre>
<p>Aber wenn ich anstelle von &quot;Arial&quot; z.B. &quot;Times New Roman&quot; eingebe, dann verändert sich die Schriftart immer noch nicht??!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1326417</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1326417</guid><dc:creator><![CDATA[Heike711]]></dc:creator><pubDate>Mon, 16 Jul 2007 11:14:25 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei der Änderung der Schriftart (Logfont) on Mon, 16 Jul 2007 11:14:35 GMT]]></title><description><![CDATA[<p>Ein Blick in die Doku zu _tcscpy!<br />
Oder ein Blick in das Sample, woher Du den Rest kopiert hast.<br />
Oder ein Blick in ein Tutorial, dass den Umgang mit Fonts zeigt!</p>
<pre><code class="language-cpp">_tcscpy(font.lfFaceName,_T(&quot;Arial&quot;));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1326458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1326458</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Mon, 16 Jul 2007 11:14:35 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei der Änderung der Schriftart (Logfont) on Mon, 16 Jul 2007 11:25:07 GMT]]></title><description><![CDATA[<p>Hi,<br />
habe das jetzt so geändert, jedoch habe ich immer noch keine Veränderung. Naja werde noch ein wenig damit rumprobieren. Und nochmals die Hilfe durchforsten, obwohl das mir eben auch wenig gebracht hat. Hab da ja nur das gefunden, was ich eben gepostet habe</p>
<pre><code class="language-cpp">wcscpy(font.lfFaceName,_T(&quot;Arial&quot;));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1326464</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1326464</guid><dc:creator><![CDATA[Heike711]]></dc:creator><pubDate>Mon, 16 Jul 2007 11:25:07 GMT</pubDate></item><item><title><![CDATA[Reply to Problem bei der Änderung der Schriftart (Logfont) on Mon, 16 Jul 2007 12:44:59 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/16614">@Heike711</a><br />
Ist deine Anwendung auch eine Unicode-Anwendung, weil du die Funktion wcscpy benutzt?</p>
<p>Wenn du z.B. noch nicht weist, ob sie später Unicode unterstützen soll oder nicht, verwende für das Kopieren der Zeichenkette die hier vorgeschlagene Funktion _tcscpy, oder lstrcpy.</p>
<p>Es ist auch ganz hilfreich die Rückgabe von</p>
<pre><code class="language-cpp">hFontNew = CreateFontIndirect(&amp;font);
</code></pre>
<p>zu überprüfen (ob erstellt werden konnte != NULL)<br />
und wenn == NULL, dann den Fehler mit GetLastError abzufragen.</p>
<p>Des weiteren wird bei jedem Aufruf der Funktion ein neues Fonthandle angelegt.<br />
Nach dem Zeichnen sollte hier noch</p>
<pre><code class="language-cpp">SelectObject(hdc, hFontOld);
DeleteObject(hFontNew);
</code></pre>
<p>stehen</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1326525</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1326525</guid><dc:creator><![CDATA[Analog Bit]]></dc:creator><pubDate>Mon, 16 Jul 2007 12:44:59 GMT</pubDate></item></channel></rss>