X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f415cab9ef1433413a1a68a982ee9b17c5a8deda..173f3c03a059a269a237aab72c6b067020a41b8c:/samples/printing/printing.cpp diff --git a/samples/printing/printing.cpp b/samples/printing/printing.cpp index bfe2f16192..e231e3bd52 100644 --- a/samples/printing/printing.cpp +++ b/samples/printing/printing.cpp @@ -77,14 +77,17 @@ bool WritePageHeader(wxPrintout *printout, wxDC *dc, const wxChar *text, float m bool MyApp::OnInit(void) { + if ( !wxApp::OnInit() ) + return false; + wxInitAllImageHandlers(); m_testFont.Create(10, wxSWISS, wxNORMAL, wxNORMAL); g_printData = new wxPrintData; - // Set an initial paper size + // You could set an initial paper size here // g_printData->SetPaperId(wxPAPER_LETTER); // for Americans - g_printData->SetPaperId(wxPAPER_A4); // for everyone else +// g_printData->SetPaperId(wxPAPER_A4); // for everyone else g_pageSetupData = new wxPageSetupDialogData; // copy over initial paper size from print record @@ -606,7 +609,7 @@ void MyPrintout::DrawPageTwo() { // GetTextExtent demo: wxString words[7] = {_T("This "), _T("is "), _T("GetTextExtent "), _T("testing "), _T("string. "), _T("Enjoy "), _T("it!")}; - long w, h; + wxCoord w, h; long x = 200, y= 250; wxFont fnt(15, wxSWISS, wxNORMAL, wxNORMAL); @@ -678,7 +681,7 @@ dc->SetFont(headerFont); float topMarginLogical = (float)(mmToLogical*topMargin); float rightMarginLogical = (float)(mmToLogical*(pageWidthMM - rightMargin)); - long xExtent, yExtent; + wxCoord xExtent, yExtent; dc->GetTextExtent(text, &xExtent, &yExtent); float xPos = (float)(((((pageWidthMM - leftMargin - rightMargin)/2.0)+leftMargin)*mmToLogical) - (xExtent/2.0)); dc->DrawText(text, (long)xPos, (long)topMarginLogical);