您的位置:程序门 -> vb -> 基础类



vb.net里怎么改!?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


vb.net里怎么改!?[已结贴,结贴人:sunmingcn]
发表于:2007-07-26 12:15:06 楼主
printer.currentx   =   x   +   3       打印的起始x坐标
printer.fontsize   =   16               应该是打印字的大小
这是vb2.0时候的程序....
现在要在vb.net改过来...
怎么改......查了下msdn   说用printdocumen组件
代替printer,但我不会用组件printer对象...谁教教我
新手......
发表于: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
发表于:2007-07-26 12:47:542楼 得分:10
同时打印还需要vb.net自带的几个控件配合,printdialog1,printpreviewdialog1等...
发表于:2007-07-26 18:29:103楼 得分:0
谢谢     研究下看能解决不


快速检索

最新资讯
热门点击