Printer, Canvas, PageWidth, PageHeight example
This example uses a button and a memo on a form. When the user clicks
the button, the content of the memo is printed, with a 200-pixel border
around the page. To run this example successfully, include
in your unit file.
void __fastcall TForm1::Button1Click(TObject *Sender)
{
TPrinter Prntr = Printer();
TRect r = Rect(200,200,Prntr->PageWidth-200,Prntr->PageHeight-200);
Prntr->BeginDoc();
Prntr->Canvas->TextRect(r, 200, 200, Memo1->Lines->Text);
Prntr->EndDoc();
}
以上是BC中自带的打印列子程序, 但是调试没有办法通过。
我以为第一句应该是 TPrinter *Prntr = Printer();
这样调试就可以通过了,不知道是不是BC真的写错了还是我没有理解请指教谢谢
--------------------next---------------------
阅读(952) | 评论(0) | 转发(0) |