如何把picturebox中的图象和控件(合成一张图)一起打印出来?

解决方案 »

  1.   

    Option Explicit
    Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As LongPrivate Sub Command2_Click()
        Load Form2
        Form2.Show
        Dim x As Single
        Dim y As Single
        Dim h As Long
        h = Picture1.hWnd
        x = Picture1.Left
        y = Picture1.Top
        Picture1.Left = 0
        Picture1.Top = 0
        Form2.Height = Picture1.Height + (Form2.Height - Form2.ScaleHeight)
        Form2.Width = Picture1.Width + (Form2.Width - Form2.ScaleWidth)
        SetParent Picture1.hWnd, Form2.hWnd
        Form2.PrintForm
        SetParent h, Me.hWnd
        Picture1.Left = x
        Picture1.Top = y
        Form2.Hide
        Unload Form2
    End Sub
      

  2.   

    '后面的数字是图象在打印页面上的左顶宽高
    printer.paintpicture picture1.picture,60,60,450,450
    printer.enddoc
      

  3.   

    首先谢谢以上朋友的回答!
    用paintform的时候,picturebox中的自己做的ocx打印不出来。我的ocx是用vc做的,vb的标准控件能打得出来。还有用paintform打印的时候会出现一个提示正在打印的框,怎么把这个框去掉?
      

  4.   

    paintform不太好使吧,如果是自画的线条图,还是按画图的程序照编一个打印程序比较爽,例如:
    for 
    (假设图线保存在数组)
    printer.line(x1,y1)-(x2,y2)next