| 发表于:2007-07-26 12:43:441楼 得分:10 |
给你个我写的例子,其实打印方面东西太多,建议楼主详细看看,很简单的 private sub printdocument1_printpage(byval sender as system.object, byval e as system.drawing.printing.printpageeventargs) dim mylinesperpage as single = 0 dim myypos as single = 0 dim mycount as integer = 0 dim myleftmargin as single = e.marginbounds.left dim mytopmargin as single = e.marginbounds.top dim myline as string mylinesperpage = e.marginbounds.height / me.font.getheight(e.graphics) dim myreader = new system.io.streamreader(myfilename, system.text.encoding.default) while (mycount < mylinesperpage) myline = myreader.readline if myline is nothing then exit while end if myypos = mytopmargin + mycount * font.getheight(e.graphics) e.graphics.drawstring(myline, font, brushes.black, myleftmargin, myypos, new stringformat) mycount += 1 if not myline is nothing then e.hasmorepages = true else e.hasmorepages = false end if end while end sub | | |
|