<?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[Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte die Schriftart einer CListBoxCtrl per CFontDialog ändern.<br />
Ich hab es so versucht:</p>
<pre><code class="language-cpp">void CMyDlg::OnSetFontBtn() 
{
	LOGFONT lf;
	m_LogListBoxCtrl.GetFont()-&gt;GetLogFont(&amp;lf);
	CFontDialog dlg(&amp;lf);
	if (dlg.DoModal() == IDOK)
	{
		CFont Font;
		Font.CreateFontIndirect(&amp;lf);
		m_LogListBoxCtrl.SetFont(&amp;Font,true);
	}
}
</code></pre>
<p>die Schriftart wird auch geändert, aber die neue Schriftart entspricht nicht der ausgewählten (sieht nach dem vestellen immer gleich aus).<br />
Kann mir jemand weiterhelfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/50020/font-von-clistboxctrl-zur-laufzeit-mit-cfontdialog-ändern</link><generator>RSS for Node</generator><lastBuildDate>Mon, 15 Jun 2026 22:04:11 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/50020.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 25 Sep 2003 15:08:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern on Thu, 25 Sep 2003 15:08:01 GMT]]></title><description><![CDATA[<p>Hallo zusammen,</p>
<p>ich möchte die Schriftart einer CListBoxCtrl per CFontDialog ändern.<br />
Ich hab es so versucht:</p>
<pre><code class="language-cpp">void CMyDlg::OnSetFontBtn() 
{
	LOGFONT lf;
	m_LogListBoxCtrl.GetFont()-&gt;GetLogFont(&amp;lf);
	CFontDialog dlg(&amp;lf);
	if (dlg.DoModal() == IDOK)
	{
		CFont Font;
		Font.CreateFontIndirect(&amp;lf);
		m_LogListBoxCtrl.SetFont(&amp;Font,true);
	}
}
</code></pre>
<p>die Schriftart wird auch geändert, aber die neue Schriftart entspricht nicht der ausgewählten (sieht nach dem vestellen immer gleich aus).<br />
Kann mir jemand weiterhelfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/360452</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/360452</guid><dc:creator><![CDATA[Claus_E]]></dc:creator><pubDate>Thu, 25 Sep 2003 15:08:01 GMT</pubDate></item><item><title><![CDATA[Reply to Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern on Thu, 25 Sep 2003 16:48:38 GMT]]></title><description><![CDATA[<p>Also wenn ich mich recht entsinne dient der Pointer auf die LOGFONT-Struktur im Konstruktor von CFontDialog nur der initialisierung. Du kannst dir den LOGFONT aus dem Dialog so holen...</p>
<pre><code class="language-cpp">LOGFONT lf;
memcpy(&amp;lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/360511</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/360511</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Thu, 25 Sep 2003 16:48:38 GMT</pubDate></item><item><title><![CDATA[Reply to Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern on Thu, 25 Sep 2003 16:50:23 GMT]]></title><description><![CDATA[<p>Ehm, bist du sicher, dass SetFont einen Pointer auf eine lokale Variable erwartet???</p>
]]></description><link>https://www.c-plusplus.net/forum/post/360514</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/360514</guid><dc:creator><![CDATA[Walli]]></dc:creator><pubDate>Thu, 25 Sep 2003 16:50:23 GMT</pubDate></item><item><title><![CDATA[Reply to Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern on Fri, 26 Sep 2003 13:28:06 GMT]]></title><description><![CDATA[<p>Vielen Dank,</p>
<p>das mit der lokalen Variable war natürlich blöd von mir. <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>so funktioniert es jetzt:</p>
<pre><code class="language-cpp">void CMyDlg::OnSetFontBtn() 
{
	LOGFONT lf;
	CFont* pFont;
	pFont = m_LogListBoxCtrl.GetFont();
	pFont-&gt;GetLogFont(&amp;lf);
	CFontDialog dlg(&amp;lf);
	if (dlg.DoModal() == IDOK)
         {
		pFont-&gt;CreateFontIndirect(&amp;lf);
		m_LogListBoxCtrl.SetFont(pFont,true);
	}
}
</code></pre>
<p>auch wenn im Debugmodus eine Debug Assertion Failed bei dem erneuten CreateFontIndirect ausgegeben wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/361057</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/361057</guid><dc:creator><![CDATA[Claus_E]]></dc:creator><pubDate>Fri, 26 Sep 2003 13:28:06 GMT</pubDate></item><item><title><![CDATA[Reply to Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern on Fri, 26 Sep 2003 13:49:17 GMT]]></title><description><![CDATA[<blockquote>
<p>auch wenn im Debugmodus eine Debug Assertion Failed bei dem erneuten CreateFontIndirect ausgegeben wird</p>
</blockquote>
<p>Sicherlich kann ich mich auf einen Platz im Bus setzen, auf den sich gerade eine ältere Oma setzen wollte. Aber das tangiert mich nur peripher ...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/361074</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/361074</guid><dc:creator><![CDATA[Oma_Ärgerer]]></dc:creator><pubDate>Fri, 26 Sep 2003 13:49:17 GMT</pubDate></item><item><title><![CDATA[Reply to Font von CListBoxCtrl zur Laufzeit mit CFontDialog ändern on Fri, 26 Sep 2003 13:53:26 GMT]]></title><description><![CDATA[<p>[quote]...den sich gerade eine ältere Oma setzen wollte<br />
[\quote]</p>
<p>bei der Oma hätte ich Skrupel, hier nicht <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/361083</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/361083</guid><dc:creator><![CDATA[Claus_E]]></dc:creator><pubDate>Fri, 26 Sep 2003 13:53:26 GMT</pubDate></item></channel></rss>