不是的,我要打印一个证书,在winform上划出一些基本的边框。
然后如何把这个打印出来?

解决方案 »

  1.   

    http://www.c-sharpcorner.com/Code/2003/March/FormPrinting.asp
      

  2.   

    我的意思是,我把证书的格式画在了 winform上,然后想打印出来这个证书。printdocument 需要设置打印来源吗?怎么设置?
      

  3.   

    既然你是画在窗体上,那就只能打印窗体,printdocument在这里无能为力
      

  4.   

    有什么问题可以去www.zhihuigu.com上去问,那有很多一流大虾.......高手如云..专门给人解决问题有问必答.....各位有时间都可以去看看!!!!!!!!!!!!!!!
      

  5.   

    Imports  System.Drawing.Printing  
     
           '  Specifies  what  happens  when  the  PrintPage  event  is  raised.  
           Private  Sub  pd_PrintPage(ByVal  sender  As  Object,  ByVal  ev  As  PrintPageEventArgs)  
                   Dim  obj  As  Bitmap  
                   Dim  iData  As  IDataObject  =  Clipboard.GetDataObject()  
                   '  Determines  whether  the  data  is  in  a  format  you  can  use.  
                   If  iData.GetDataPresent(DataFormats.Bitmap)  Then  
                           obj  =  iData.GetData(DataFormats.Bitmap)  
                           ev.Graphics.DrawImage(obj,  _  
                                   obj.GetBounds(System.Drawing.GraphicsUnit.Pixel))      'ev.Graphics.VisibleClipBounds)  
                   End  If  
                   ev.HasMorePages  =  False  
           End  Sub  
     
           Private  Sub  Button1_Click_1(ByVal  sender  As  System.Object,  ByVal  e  As  System.EventArgs)  Handles  Button1.Click  
                   Try  
                           'Printscreen  
                           SendKeys.SendWait("%{PRTSC}")  
                           '  Assumes  the  default  printer.  
                           Dim  pd  As  New  PrintDocument()  
                           AddHandler  pd.PrintPage,  AddressOf  Me.pd_PrintPage  
                           pd.DefaultPageSettings.Landscape  =  True  
                           pd.Print()  
                   Catch  ex  As  Exception  
                           MessageBox.Show("An  error  occurred  while  printing"  &  vbCrLf  &  _  
                                   ex.ToString(),  "Error")  
                   End  Try  
           End  Sub  
    End  Class