<?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[Zeilendrucken, doch wie TextHoehe ermitteln???]]></title><description><![CDATA[<p>Hallo!</p>
<p>Weiss jemand wie ich die Hoehe einer Zeile beim Drucken ermitteln kann??<br />
Die ist bei jedem Drucker anders... Zur Zeit habe ich konstante Werte fuer eine Zeile: py+=55;<br />
Das geht bei einigen Druckern gut, bei einigen wieder nich... (Zeilen liegen etwas uebereinander...)</p>
<p>Wie kann ich also die Hoehe einer Zeile ermitteln???</p>
<pre><code class="language-cpp">void CMovieDBDlg::Print()
{
    HDC hdcPrn;

    CPrintDialog PrintDlg(FALSE, PD_ALLPAGES | PD_RETURNDC, NULL);
    PrintDlg.DoModal();
    hdcPrn = PrintDlg.GetPrinterDC();
    if(hdcPrn != NULL)
    {

        // create a CDC and attach it to the default printer
        CDC pDC;
        pDC.Attach(hdcPrn);

        int cx = pDC.GetDeviceCaps(PHYSICALWIDTH);
        int cy = pDC.GetDeviceCaps(PHYSICALHEIGHT);
        bool newpage = 1;
        int count = 0;
        int py;
        CString sPageCount;
        int iPageCount = 0;
        const int iLeftMargin = 100;
        const int iRowCDName = 2000;
        CRect rcHeaderBox;
        CRect rcFooterBox;
        rcHeaderBox.SetRect(iLeftMargin, 0, cx, 55);
        rcFooterBox.SetRect(iLeftMargin, cy - 100, cx, cy - 45); 
        pDC.StartDoc(&quot;Media DB&quot;);

        for (int i = 0; i &lt; m_szMovie.GetItemCount(); i++)
        {

            if (newpage)
            {
                pDC.StartPage();
                py = 0;
                iPageCount++;
                //Print Header
                pDC.SetBkColor(RGB(228,228,228));
                pDC.ExtTextOut(iLeftMargin, py, ETO_OPAQUE, rcHeaderBox, &quot;&quot;, NULL);
                pDC.TextOut(iLeftMargin, py, &quot;Media Name&quot;);
                pDC.TextOut(iRowCDName, py, &quot;Nr&quot;);
                py = 70;
                newpage = false;
            }
            pDC.TextOut(iLeftMargin,py,m_szMovie.GetItemText(i,0));
            pDC.TextOut(iRowCDName, py, m_szMovie.GetItemText(i,1));
            py+=55;
            if (py &gt; (cy - 100))
            {
                // Print Footer
                py = cy - 100;
                pDC.SetBkColor(RGB(228,228,228));
                pDC.ExtTextOut(iLeftMargin, py, ETO_OPAQUE, rcFooterBox, &quot;&quot;, NULL);
                pDC.TextOut(iLeftMargin, py, m_szUser + &quot;'s Media Datenbank&quot;);
                sPageCount.Format(&quot;%d&quot;, iPageCount);
                pDC.TextOut(iRowCDName, py, &quot;Page: &quot; + sPageCount);
                pDC.EndPage();
                newpage = true;
            }

        }
        // Print Footer
        py = cy - 100;
        pDC.SetBkColor(RGB(228,228,228));
        pDC.ExtTextOut(iLeftMargin, py, ETO_OPAQUE, rcFooterBox, &quot;&quot;, NULL);
        pDC.TextOut(iLeftMargin, py, m_szUser + &quot;'s Media Datenbank&quot;);
        sPageCount.Format(&quot;%d&quot;, iPageCount);
        pDC.TextOut(iRowCDName, py, &quot;Page: &quot; + sPageCount);

        pDC.EndPage();
        pDC.EndDoc();
        pDC.DeleteDC();

        }
</code></pre>
<p>*Ratlos sei...</p>
<p>Gruesse,<br />
KnOxX</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/3310/zeilendrucken-doch-wie-texthoehe-ermitteln</link><generator>RSS for Node</generator><lastBuildDate>Mon, 27 Apr 2026 22:36:09 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/3310.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 20 Nov 2002 13:52:00 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Zeilendrucken, doch wie TextHoehe ermitteln??? on Wed, 20 Nov 2002 13:52:00 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Weiss jemand wie ich die Hoehe einer Zeile beim Drucken ermitteln kann??<br />
Die ist bei jedem Drucker anders... Zur Zeit habe ich konstante Werte fuer eine Zeile: py+=55;<br />
Das geht bei einigen Druckern gut, bei einigen wieder nich... (Zeilen liegen etwas uebereinander...)</p>
<p>Wie kann ich also die Hoehe einer Zeile ermitteln???</p>
<pre><code class="language-cpp">void CMovieDBDlg::Print()
{
    HDC hdcPrn;

    CPrintDialog PrintDlg(FALSE, PD_ALLPAGES | PD_RETURNDC, NULL);
    PrintDlg.DoModal();
    hdcPrn = PrintDlg.GetPrinterDC();
    if(hdcPrn != NULL)
    {

        // create a CDC and attach it to the default printer
        CDC pDC;
        pDC.Attach(hdcPrn);

        int cx = pDC.GetDeviceCaps(PHYSICALWIDTH);
        int cy = pDC.GetDeviceCaps(PHYSICALHEIGHT);
        bool newpage = 1;
        int count = 0;
        int py;
        CString sPageCount;
        int iPageCount = 0;
        const int iLeftMargin = 100;
        const int iRowCDName = 2000;
        CRect rcHeaderBox;
        CRect rcFooterBox;
        rcHeaderBox.SetRect(iLeftMargin, 0, cx, 55);
        rcFooterBox.SetRect(iLeftMargin, cy - 100, cx, cy - 45); 
        pDC.StartDoc(&quot;Media DB&quot;);

        for (int i = 0; i &lt; m_szMovie.GetItemCount(); i++)
        {

            if (newpage)
            {
                pDC.StartPage();
                py = 0;
                iPageCount++;
                //Print Header
                pDC.SetBkColor(RGB(228,228,228));
                pDC.ExtTextOut(iLeftMargin, py, ETO_OPAQUE, rcHeaderBox, &quot;&quot;, NULL);
                pDC.TextOut(iLeftMargin, py, &quot;Media Name&quot;);
                pDC.TextOut(iRowCDName, py, &quot;Nr&quot;);
                py = 70;
                newpage = false;
            }
            pDC.TextOut(iLeftMargin,py,m_szMovie.GetItemText(i,0));
            pDC.TextOut(iRowCDName, py, m_szMovie.GetItemText(i,1));
            py+=55;
            if (py &gt; (cy - 100))
            {
                // Print Footer
                py = cy - 100;
                pDC.SetBkColor(RGB(228,228,228));
                pDC.ExtTextOut(iLeftMargin, py, ETO_OPAQUE, rcFooterBox, &quot;&quot;, NULL);
                pDC.TextOut(iLeftMargin, py, m_szUser + &quot;'s Media Datenbank&quot;);
                sPageCount.Format(&quot;%d&quot;, iPageCount);
                pDC.TextOut(iRowCDName, py, &quot;Page: &quot; + sPageCount);
                pDC.EndPage();
                newpage = true;
            }

        }
        // Print Footer
        py = cy - 100;
        pDC.SetBkColor(RGB(228,228,228));
        pDC.ExtTextOut(iLeftMargin, py, ETO_OPAQUE, rcFooterBox, &quot;&quot;, NULL);
        pDC.TextOut(iLeftMargin, py, m_szUser + &quot;'s Media Datenbank&quot;);
        sPageCount.Format(&quot;%d&quot;, iPageCount);
        pDC.TextOut(iRowCDName, py, &quot;Page: &quot; + sPageCount);

        pDC.EndPage();
        pDC.EndDoc();
        pDC.DeleteDC();

        }
</code></pre>
<p>*Ratlos sei...</p>
<p>Gruesse,<br />
KnOxX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/15597</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/15597</guid><dc:creator><![CDATA[KnOxX]]></dc:creator><pubDate>Wed, 20 Nov 2002 13:52:00 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilendrucken, doch wie TextHoehe ermitteln??? on Thu, 21 Nov 2002 07:46:00 GMT]]></title><description><![CDATA[<p>Das Habe ich mir Errechnet wobei ich von den Maßen eines Din A4 Blattes ausgegangen bin.</p>
<p>Anzahl X Pixel durch 210mm = X Pixel pro Millimeter<br />
Anzahl Y Pixel durch 300mm = Y Pixel pro Millimeter</p>
<p>Die Höhe der schrift kanst du ja auch bestimmen!</p>
<p>Siehe CFont und SelectObject()</p>
]]></description><link>https://www.c-plusplus.net/forum/post/15598</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/15598</guid><dc:creator><![CDATA[ldr-alpha]]></dc:creator><pubDate>Thu, 21 Nov 2002 07:46:00 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilendrucken, doch wie TextHoehe ermitteln??? on Thu, 21 Nov 2002 12:14:00 GMT]]></title><description><![CDATA[<p>Danke fuer die Antwort!!</p>
<p>Ich wuerde es nur gerne etwas dynamischer haben <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>Hier habe ich es gefunden:</p>
<p>[url] <a href="http://www.codeproject.com/printing/print_support.asp" rel="nofollow">http://www.codeproject.com/printing/print_support.asp</a> [/url]</p>
<p>Gruesse,<br />
KnOxX</p>
]]></description><link>https://www.c-plusplus.net/forum/post/15599</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/15599</guid><dc:creator><![CDATA[KnOxX]]></dc:creator><pubDate>Thu, 21 Nov 2002 12:14:00 GMT</pubDate></item><item><title><![CDATA[Reply to Zeilendrucken, doch wie TextHoehe ermitteln??? on Fri, 30 Apr 2004 13:41:01 GMT]]></title><description><![CDATA[<p>wow das hier ist genau das was ich gebraucht habe.</p>
<p>Nur weis ich nicht wie ich das neue CRect object einbauen soll bzw. benutzen mit dem CDC objekt...</p>
<p>:-\</p>
<p>Könntet ihr mir da helfen pls? <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>
<p>MfG<br />
T1c4L</p>
]]></description><link>https://www.c-plusplus.net/forum/post/511867</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/511867</guid><dc:creator><![CDATA[T1c4L]]></dc:creator><pubDate>Fri, 30 Apr 2004 13:41:01 GMT</pubDate></item></channel></rss>