Printing a list

Robert Luchner r.luchner at gmx.at
Mon Oct 2 11:55:10 PDT 2006


Hi all!
My enviroment: Windows XP, wxWidgets 7.0.0, Visual C++ Express 2005
I want to print a "simple" list. This list can grow very large (i don't 
n know how many pages, ma be some 100....)
My Code:
bool MyPrintout :: OnPrintPage(int page)
{
    wxDC *dc = GetDC();
    if (dc)
    {
        dc->SetPen(* wxBLACK_PEN);
        dc->SetFont(dlg->m_testFont);
        WTEXT text[MAXSTR], buffer[MAXSTR];

        int fontheight = dc->GetCharHeight();
        int line = 100;
        for (int i = 0; i < 100; i++) // only for testin...
        {
            stradd(text, "Zeile: ", itoa(i, (char*)buffer, 10), NULL);
            dc->DrawText(wxT(text), 100, line);
            line+= fontheight;
             if (line > pageHeight)
             {
                line = 0;
                formfeed;
             }
        }
        m_pageNum = 0;
        return true;
    }
    else
        return false;
}

bool MyPrintout::HasPage(int pageNum)
{
    if (m_pageNum > 0)
        return true;
    return false;
}

The variable m_pageNum is defined in the declaration of MyPrintout.
If i print only 66 lines are printed.
I's clear, all the hunded lines don't fit into the page! After printing 
66 (or less) lines i should have a formfeed.
What's my mistake?
TNX
Robert






More information about the wx-users mailing list