1 /////////////////////////////////////////////////////////////////////////////
2 // Name: samples/printing.cpp
3 // Purpose: Printing demo for wxWidgets
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 // For compilers that support precompilation, includes "wx/wx.h".
13 #include "wx/wxprec.h"
23 #if !wxUSE_PRINTING_ARCHITECTURE
24 #error "You must set wxUSE_PRINTING_ARCHITECTURE to 1 in setup.h, and recompile the library."
27 // Set this to 1 if you want to test PostScript printing under MSW.
28 // However, you'll also need to edit src/msw/makefile.nt.
29 #define wxTEST_POSTSCRIPT_IN_MSW 0
32 #include "wx/metafile.h"
34 #include "wx/printdlg.h"
38 #if wxTEST_POSTSCRIPT_IN_MSW
39 #include "wx/generic/printps.h"
40 #include "wx/generic/prntdlgg.h"
44 #include "wx/mac/printdlg.h"
50 #include "mondrian.xpm"
53 #if wxUSE_LIBGNOMEPRINT
54 #include "wx/html/forcelnk.h"
55 FORCE_LINK(gnome_print
)
60 MyFrame
*frame
= (MyFrame
*) NULL
;
61 // int orientation = wxPORTRAIT;
63 // Global print data, to remember settings during the session
64 wxPrintData
*g_printData
= (wxPrintData
*) NULL
;
66 // Global page setup data
67 wxPageSetupDialogData
* g_pageSetupData
= (wxPageSetupDialogData
*) NULL
;
72 // Writes a header on a page. Margin units are in millimetres.
73 bool WritePageHeader(wxPrintout
*printout
, wxDC
*dc
, const wxChar
*text
, float mmToLogical
);
75 // The `main program' equivalent, creating the windows and returning the
78 bool MyApp::OnInit(void)
80 wxInitAllImageHandlers();
82 m_testFont
.Create(10, wxSWISS
, wxNORMAL
, wxNORMAL
);
84 g_printData
= new wxPrintData
;
85 // Set an initial paper size
86 // g_printData->SetPaperId(wxPAPER_LETTER); // for Americans
87 g_printData
->SetPaperId(wxPAPER_A4
); // for everyone else
89 g_pageSetupData
= new wxPageSetupDialogData
;
90 // copy over initial paper size from print record
91 (*g_pageSetupData
) = *g_printData
;
92 // Set some initial page margins in mm.
93 g_pageSetupData
->SetMarginTopLeft(wxPoint(15, 15));
94 g_pageSetupData
->SetMarginBottomRight(wxPoint(15, 15));
96 // Create the main frame window
97 frame
= new MyFrame((wxFrame
*) NULL
, _T("wxWidgets Printing Demo"),
98 wxPoint(0, 0), wxSize(400, 400));
101 // Give it a status line
102 frame
->CreateStatusBar(2);
103 #endif // wxUSE_STATUSBAR
105 // Load icon and bitmap
106 frame
->SetIcon( wxICON( mondrian
) );
109 wxMenu
*file_menu
= new wxMenu
;
111 file_menu
->Append(WXPRINT_PRINT
, _T("&Print..."), _T("Print"));
112 file_menu
->Append(WXPRINT_PAGE_SETUP
, _T("Page Set&up..."), _T("Page setup"));
114 file_menu
->Append(WXPRINT_PAGE_MARGINS
, _T("Page Margins..."), _T("Page margins"));
116 file_menu
->Append(WXPRINT_PREVIEW
, _T("Print Pre&view"), _T("Preview"));
120 wxAcceleratorEntry entries
[1];
121 entries
[0].Set(wxACCEL_CTRL
, (int) 'V', WXPRINT_PREVIEW
);
122 wxAcceleratorTable
accel(1, entries
);
123 frame
->SetAcceleratorTable(accel
);
126 #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
127 file_menu
->AppendSeparator();
128 file_menu
->Append(WXPRINT_PRINT_PS
, _T("Print PostScript..."), _T("Print (PostScript)"));
129 file_menu
->Append(WXPRINT_PAGE_SETUP_PS
, _T("Page Setup PostScript..."), _T("Page setup (PostScript)"));
130 file_menu
->Append(WXPRINT_PREVIEW_PS
, _T("Print Preview PostScript"), _T("Preview (PostScript)"));
133 file_menu
->AppendSeparator();
134 file_menu
->Append(WXPRINT_ANGLEUP
, _T("Angle up\tAlt-U"), _T("Raise rotated text angle"));
135 file_menu
->Append(WXPRINT_ANGLEDOWN
, _T("Angle down\tAlt-D"), _T("Lower rotated text angle"));
136 file_menu
->AppendSeparator();
137 file_menu
->Append(WXPRINT_QUIT
, _T("E&xit"), _T("Exit program"));
139 wxMenu
*help_menu
= new wxMenu
;
140 help_menu
->Append(WXPRINT_ABOUT
, _T("&About"), _T("About this demo"));
142 wxMenuBar
*menu_bar
= new wxMenuBar
;
144 menu_bar
->Append(file_menu
, _T("&File"));
145 menu_bar
->Append(help_menu
, _T("&Help"));
147 // Associate the menu bar with the frame
148 frame
->SetMenuBar(menu_bar
);
150 MyCanvas
*canvas
= new MyCanvas(frame
, wxPoint(0, 0), wxSize(100, 100), wxRETAINED
|wxHSCROLL
|wxVSCROLL
);
152 // Give it scrollbars: the virtual canvas is 20 * 50 = 1000 pixels in each direction
153 canvas
->SetScrollbars(20, 20, 50, 50);
155 frame
->canvas
= canvas
;
157 frame
->Centre(wxBOTH
);
161 frame
->SetStatusText(_T("Printing demo"));
162 #endif // wxUSE_STATUSBAR
172 delete g_pageSetupData
;
176 BEGIN_EVENT_TABLE(MyFrame
, wxFrame
)
177 EVT_MENU(WXPRINT_QUIT
, MyFrame::OnExit
)
178 EVT_MENU(WXPRINT_PRINT
, MyFrame::OnPrint
)
179 EVT_MENU(WXPRINT_PREVIEW
, MyFrame::OnPrintPreview
)
180 EVT_MENU(WXPRINT_PAGE_SETUP
, MyFrame::OnPageSetup
)
181 EVT_MENU(WXPRINT_ABOUT
, MyFrame::OnPrintAbout
)
182 #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
183 EVT_MENU(WXPRINT_PRINT_PS
, MyFrame::OnPrintPS
)
184 EVT_MENU(WXPRINT_PREVIEW_PS
, MyFrame::OnPrintPreviewPS
)
185 EVT_MENU(WXPRINT_PAGE_SETUP_PS
, MyFrame::OnPageSetupPS
)
188 EVT_MENU(WXPRINT_PAGE_MARGINS
, MyFrame::OnPageMargins
)
190 EVT_MENU(WXPRINT_ANGLEUP
, MyFrame::OnAngleUp
)
191 EVT_MENU(WXPRINT_ANGLEDOWN
, MyFrame::OnAngleDown
)
194 // Define my frame constructor
195 MyFrame::MyFrame(wxFrame
*frame
, const wxString
& title
, const wxPoint
& pos
, const wxSize
& size
):
196 wxFrame(frame
, wxID_ANY
, title
, pos
, size
)
201 wxImage
image( wxT("test.jpg") );
204 for (i
= 0; i
< image
.GetWidth(); i
++)
205 for (j
= 0; j
< image
.GetHeight(); j
++)
206 image
.SetAlpha( i
, j
, 50 );
211 void MyFrame::OnExit(wxCommandEvent
& WXUNUSED(event
))
213 Close(true /*force closing*/);
216 void MyFrame::OnPrint(wxCommandEvent
& WXUNUSED(event
))
218 wxPrintDialogData
printDialogData(* g_printData
);
220 wxPrinter
printer(& printDialogData
);
221 MyPrintout
printout(_T("My printout"));
222 if (!printer
.Print(this, &printout
, true /*prompt*/))
224 if (wxPrinter::GetLastError() == wxPRINTER_ERROR
)
225 wxMessageBox(_T("There was a problem printing.\nPerhaps your current printer is not set correctly?"), _T("Printing"), wxOK
);
227 wxMessageBox(_T("You canceled printing"), _T("Printing"), wxOK
);
231 (*g_printData
) = printer
.GetPrintDialogData().GetPrintData();
235 void MyFrame::OnPrintPreview(wxCommandEvent
& WXUNUSED(event
))
237 // Pass two printout objects: for preview, and possible printing.
238 wxPrintDialogData
printDialogData(* g_printData
);
239 wxPrintPreview
*preview
= new wxPrintPreview(new MyPrintout
, new MyPrintout
, & printDialogData
);
243 wxMessageBox(_T("There was a problem previewing.\nPerhaps your current printer is not set correctly?"), _T("Previewing"), wxOK
);
247 wxPreviewFrame
*frame
= new wxPreviewFrame(preview
, this, _T("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
248 frame
->Centre(wxBOTH
);
253 void MyFrame::OnPageSetup(wxCommandEvent
& WXUNUSED(event
))
255 (*g_pageSetupData
) = *g_printData
;
257 wxPageSetupDialog
pageSetupDialog(this, g_pageSetupData
);
258 pageSetupDialog
.ShowModal();
260 (*g_printData
) = pageSetupDialog
.GetPageSetupDialogData().GetPrintData();
261 (*g_pageSetupData
) = pageSetupDialog
.GetPageSetupDialogData();
264 #if defined(__WXMSW__) && wxTEST_POSTSCRIPT_IN_MSW
265 void MyFrame::OnPrintPS(wxCommandEvent
& WXUNUSED(event
))
267 wxPostScriptPrinter
printer(g_printData
);
268 MyPrintout
printout(_T("My printout"));
269 printer
.Print(this, &printout
, true/*prompt*/);
271 (*g_printData
) = printer
.GetPrintData();
274 void MyFrame::OnPrintPreviewPS(wxCommandEvent
& WXUNUSED(event
))
276 // Pass two printout objects: for preview, and possible printing.
277 wxPrintDialogData
printDialogData(* g_printData
);
278 wxPrintPreview
*preview
= new wxPrintPreview(new MyPrintout
, new MyPrintout
, & printDialogData
);
279 wxPreviewFrame
*frame
= new wxPreviewFrame(preview
, this, _T("Demo Print Preview"), wxPoint(100, 100), wxSize(600, 650));
280 frame
->Centre(wxBOTH
);
285 void MyFrame::OnPageSetupPS(wxCommandEvent
& WXUNUSED(event
))
287 (*g_pageSetupData
) = * g_printData
;
289 wxGenericPageSetupDialog
pageSetupDialog(this, g_pageSetupData
);
290 pageSetupDialog
.ShowModal();
292 (*g_printData
) = pageSetupDialog
.GetPageSetupDialogData().GetPrintData();
293 (*g_pageSetupData
) = pageSetupDialog
.GetPageSetupDialogData();
299 void MyFrame::OnPageMargins(wxCommandEvent
& WXUNUSED(event
))
301 (*g_pageSetupData
) = *g_printData
;
303 wxMacPageMarginsDialog
pageMarginsDialog(this, g_pageSetupData
);
304 pageMarginsDialog
.ShowModal();
306 (*g_printData
) = pageMarginsDialog
.GetPageSetupDialogData().GetPrintData();
307 (*g_pageSetupData
) = pageMarginsDialog
.GetPageSetupDialogData();
312 void MyFrame::OnPrintAbout(wxCommandEvent
& WXUNUSED(event
))
314 (void)wxMessageBox(_T("wxWidgets printing demo\nAuthor: Julian Smart"),
315 _T("About wxWidgets printing demo"), wxOK
|wxCENTRE
);
318 void MyFrame::OnAngleUp(wxCommandEvent
& WXUNUSED(event
))
324 void MyFrame::OnAngleDown(wxCommandEvent
& WXUNUSED(event
))
330 void MyFrame::Draw(wxDC
& dc
)
332 // This routine just draws a bunch of random stuff on the screen so that we
333 // can check that different types of object are being drawn consistently
334 // between the screen image, the print preview image (at various zoom
335 // levels), and the printed page.
336 dc
.SetBackground(*wxWHITE_BRUSH
);
338 dc
.SetFont(wxGetApp().m_testFont
);
340 dc
.SetBackgroundMode(wxTRANSPARENT
);
342 dc
.SetPen(*wxBLACK_PEN
);
343 dc
.SetBrush(*wxLIGHT_GREY_BRUSH
);
344 dc
.DrawRectangle(0, 0, 230, 350);
345 dc
.DrawLine(0, 0, 229, 349);
346 dc
.DrawLine(229, 0, 0, 349);
347 dc
.SetBrush(*wxTRANSPARENT_BRUSH
);
349 dc
.SetBrush(*wxCYAN_BRUSH
);
350 dc
.SetPen(*wxRED_PEN
);
352 dc
.DrawRoundedRectangle(0, 20, 200, 80, 20);
354 dc
.DrawText( wxT("Rectangle 200 by 80"), 40, 40);
356 dc
.SetPen( wxPen(*wxBLACK
,0,wxDOT_DASH
) );
357 dc
.DrawEllipse(50, 140, 100, 50);
358 dc
.SetPen(*wxRED_PEN
);
360 dc
.DrawText( wxT("Test message: this is in 10 point text"), 10, 180);
363 char *test
= "Hebrew שלום -- Japanese (日本語)";
364 wxString tmp
= wxConvUTF8
.cMB2WC( test
);
365 dc
.DrawText( tmp
, 10, 200 );
379 dc
.DrawPolygon( 5, points
, 20, 250, wxODDEVEN_RULE
);
380 dc
.DrawPolygon( 5, points
, 50, 250, wxWINDING_RULE
);
382 dc
.DrawEllipticArc( 80, 250, 60, 30, 0.0, 270.0 );
392 dc
.DrawSpline( 4, points
);
394 dc
.DrawArc( 20,10, 10,10, 25,40 );
398 str
.Printf( wxT("---- Text at angle %d ----"), i
);
399 dc
.DrawRotatedText( str
, 100, 300, i
);
402 str
.Printf( wxT("---- Text at angle %d ----"), i
);
403 dc
.DrawRotatedText( str
, 100, 300, i
);
405 wxIcon my_icon
= wxICON(mondrian
) ;
407 dc
.DrawIcon( my_icon
, 100, 100);
410 dc
.DrawBitmap( m_bitmap
, 10, 10 );
413 void MyFrame::OnSize(wxSizeEvent
& event
)
415 wxFrame::OnSize(event
);
418 BEGIN_EVENT_TABLE(MyCanvas
, wxScrolledWindow
)
419 EVT_MOUSE_EVENTS(MyCanvas::OnEvent
)
422 MyCanvas::MyCanvas(wxFrame
*frame
, const wxPoint
& pos
, const wxSize
& size
, long style
):
423 wxScrolledWindow(frame
, wxID_ANY
, pos
, size
, style
)
425 SetBackgroundColour(* wxWHITE
);
428 void MyCanvas::OnDraw(wxDC
& dc
)
433 void MyCanvas::OnEvent(wxMouseEvent
& WXUNUSED(event
))
437 bool MyPrintout::OnPrintPage(int page
)
447 // Draw page numbers at top left corner of printable area, sized so that
448 // screen size of text matches paper size.
449 MapScreenSizeToPage();
451 wxSprintf(buf
, wxT("PAGE %d"), page
);
452 dc
->DrawText(buf
, 0, 0);
460 bool MyPrintout::OnBeginDocument(int startPage
, int endPage
)
462 if (!wxPrintout::OnBeginDocument(startPage
, endPage
))
468 void MyPrintout::GetPageInfo(int *minPage
, int *maxPage
, int *selPageFrom
, int *selPageTo
)
476 bool MyPrintout::HasPage(int pageNum
)
478 return (pageNum
== 1 || pageNum
== 2);
481 void MyPrintout::DrawPageOne()
483 // You might use THIS code if you were scaling graphics of known size to fit
484 // on the page. The commented-out code illustrates different ways of scaling
487 // We know the graphic is 230x350. If we didn't know this, we'd need to
492 // This sets the user scale and origin of the DC so that the image fits
493 // within the paper rectangle (but the edges could be cut off by printers
494 // that can't print to the edges of the paper -- which is most of them. Use
495 // this if your image already has its own margins.
496 // FitThisSizeToPaper(wxSize(maxX, maxY));
497 // wxRect fitRect = GetLogicalPaperRect();
499 // This sets the user scale and origin of the DC so that the image fits
500 // within the page rectangle, which is the printable area on Mac and MSW
501 // and is the entire page on other platforms.
502 // FitThisSizeToPage(wxSize(maxX, maxY));
503 // wxRect fitRect = GetLogicalPageRect();
505 // This sets the user scale and origin of the DC so that the image fits
506 // within the page margins as specified by g_PageSetupData, which you can
507 // change (on some platforms, at least) in the Page Setup dialog. Note that
508 // on Mac, the native Page Setup dialog doesn't let you change the margins
509 // of a wxPageSetupDialogData object, so you'll have to write your own dialog or
510 // use the Mac-only wxMacPageMarginsDialog, as we do in this program.
511 FitThisSizeToPageMargins(wxSize(maxX
, maxY
), *g_pageSetupData
);
512 wxRect fitRect
= GetLogicalPageMarginsRect(*g_pageSetupData
);
514 // This sets the user scale and origin of the DC so that the image appears
515 // on the paper at the same size that it appears on screen (i.e., 10-point
516 // type on screen is 10-point on the printed page) and is positioned in the
517 // top left corner of the page rectangle (just as the screen image appears
518 // in the top left corner of the window).
519 // MapScreenSizeToPage();
520 // wxRect fitRect = GetLogicalPageRect();
522 // You could also map the screen image to the entire paper at the same size
523 // as it appears on screen.
524 // MapScreenSizeToPaper();
525 // wxRect fitRect = GetLogicalPaperRect();
527 // You might also wish to do you own scaling in order to draw objects at
528 // full native device resolution. In this case, you should do the following.
529 // Note that you can use the GetLogicalXXXRect() commands to obtain the
530 // appropriate rect to scale to.
531 // MapScreenSizeToDevice();
532 // wxRect fitRect = GetLogicalPageRect();
534 // Each of the preceding Fit or Map routines positions the origin so that
535 // the drawn image is positioned at the top left corner of the reference
536 // rectangle. You can easily center or right- or bottom-justify the image as
539 // This offsets the image so that it is centered within the reference
540 // rectangle defined above.
541 wxCoord xoff
= (fitRect
.width
- maxX
) / 2;
542 wxCoord yoff
= (fitRect
.height
- maxY
) / 2;
543 OffsetLogicalOrigin(xoff
, yoff
);
545 // This offsets the image so that it is positioned at the bottom right of
546 // the reference rectangle defined above.
547 // wxCoord xoff = (fitRect.width - maxX);
548 // wxCoord yoff = (fitRect.height - maxY);
549 // OffsetLogicalOrigin(xoff, yoff);
551 frame
->Draw(*GetDC());
554 void MyPrintout::DrawPageTwo()
556 // You might use THIS code to set the printer DC to ROUGHLY reflect
557 // the screen text size. This page also draws lines of actual length
560 // Compare this to DrawPageOne(), which uses the really convenient routines
561 // from wxPrintout to fit the screen image onto the printed page. This page
562 // illustrates how to do all the scaling calculations yourself, if you're so
567 // Get the logical pixels per inch of screen and printer
568 int ppiScreenX
, ppiScreenY
;
569 GetPPIScreen(&ppiScreenX
, &ppiScreenY
);
570 int ppiPrinterX
, ppiPrinterY
;
571 GetPPIPrinter(&ppiPrinterX
, &ppiPrinterY
);
573 // This scales the DC so that the printout roughly represents the the screen
574 // scaling. The text point size _should_ be the right size but in fact is
575 // too small for some reason. This is a detail that will need to be
576 // addressed at some point but can be fudged for the moment.
577 float scale
= (float)((float)ppiPrinterX
/(float)ppiScreenX
);
579 // Now we have to check in case our real page size is reduced (e.g. because
580 // we're drawing to a print preview memory DC)
581 int pageWidth
, pageHeight
;
584 GetPageSizePixels(&pageWidth
, &pageHeight
);
586 // If printer pageWidth == current DC width, then this doesn't change. But w
587 // might be the preview bitmap width, so scale down.
588 float overallScale
= scale
* (float)(w
/(float)pageWidth
);
589 dc
->SetUserScale(overallScale
, overallScale
);
591 // Calculate conversion factor for converting millimetres into logical
592 // units. There are approx. 25.4 mm to the inch. There are ppi device units
593 // to the inch. Therefore 1 mm corresponds to ppi/25.4 device units. We also
594 // divide by the screen-to-printer scaling factor, because we need to
595 // unscale to pass logical units to DrawLine.
597 // Draw 50 mm by 50 mm L shape
598 float logUnitsFactor
= (float)(ppiPrinterX
/(scale
*25.4));
599 float logUnits
= (float)(50*logUnitsFactor
);
600 dc
->SetPen(* wxBLACK_PEN
);
601 dc
->DrawLine(50, 250, (long)(50.0 + logUnits
), 250);
602 dc
->DrawLine(50, 250, 50, (long)(250.0 + logUnits
));
604 dc
->SetBackgroundMode(wxTRANSPARENT
);
605 dc
->SetBrush(*wxTRANSPARENT_BRUSH
);
607 { // GetTextExtent demo:
608 wxString words
[7] = {_T("This "), _T("is "), _T("GetTextExtent "), _T("testing "), _T("string. "), _T("Enjoy "), _T("it!")};
610 long x
= 200, y
= 250;
611 wxFont
fnt(15, wxSWISS
, wxNORMAL
, wxNORMAL
);
615 for (int i
= 0; i
< 7; i
++)
617 wxString word
= words
[i
];
618 word
.Remove( word
.Len()-1, 1 );
619 dc
->GetTextExtent(word
, &w
, &h
);
620 dc
->DrawRectangle(x
, y
, w
, h
);
621 dc
->GetTextExtent(words
[i
], &w
, &h
);
622 dc
->DrawText(words
[i
], x
, y
);
628 dc
->SetFont(wxGetApp().m_testFont
);
630 dc
->DrawText(_T("Some test text"), 200, 300 );
635 int rightMargin
= 20;
637 int bottomMargin
= 20;
639 int pageWidthMM
, pageHeightMM
;
640 GetPageSizeMM(&pageWidthMM
, &pageHeightMM
);
642 float leftMarginLogical
= (float)(logUnitsFactor
*leftMargin
);
643 float topMarginLogical
= (float)(logUnitsFactor
*topMargin
);
644 float bottomMarginLogical
= (float)(logUnitsFactor
*(pageHeightMM
- bottomMargin
));
645 float rightMarginLogical
= (float)(logUnitsFactor
*(pageWidthMM
- rightMargin
));
647 dc
->SetPen(* wxRED_PEN
);
648 dc
->DrawLine( (long)leftMarginLogical
, (long)topMarginLogical
,
649 (long)rightMarginLogical
, (long)topMarginLogical
);
650 dc
->DrawLine( (long)leftMarginLogical
, (long)bottomMarginLogical
,
651 (long)rightMarginLogical
, (long)bottomMarginLogical
);
653 WritePageHeader(this, dc
, _T("A header"), logUnitsFactor
);
656 // Writes a header on a page. Margin units are in millimetres.
657 bool WritePageHeader(wxPrintout
*printout
, wxDC
*dc
, const wxChar
*text
, float mmToLogical
)
660 static wxFont *headerFont = (wxFont *) NULL;
663 headerFont = wxTheFontList->FindOrCreateFont(16, wxSWISS, wxNORMAL, wxBOLD);
665 dc->SetFont(headerFont);
668 int pageWidthMM
, pageHeightMM
;
670 printout
->GetPageSizeMM(&pageWidthMM
, &pageHeightMM
);
671 wxUnusedVar(pageHeightMM
);
675 int rightMargin
= 10;
677 float leftMarginLogical
= (float)(mmToLogical
*leftMargin
);
678 float topMarginLogical
= (float)(mmToLogical
*topMargin
);
679 float rightMarginLogical
= (float)(mmToLogical
*(pageWidthMM
- rightMargin
));
681 long xExtent
, yExtent
;
682 dc
->GetTextExtent(text
, &xExtent
, &yExtent
);
683 float xPos
= (float)(((((pageWidthMM
- leftMargin
- rightMargin
)/2.0)+leftMargin
)*mmToLogical
) - (xExtent
/2.0));
684 dc
->DrawText(text
, (long)xPos
, (long)topMarginLogical
);
686 dc
->SetPen(* wxBLACK_PEN
);
687 dc
->DrawLine( (long)leftMarginLogical
, (long)(topMarginLogical
+yExtent
),
688 (long)rightMarginLogical
, (long)topMarginLogical
+yExtent
);