PaintPicture方法要求对象一定得是Ipicture对象,象Picture.image之类才可以

解决方案 »

  1.   

    PaintPicture方法????????这个是缩放图片的吧...
    我是说只打印一个控件.
    比如说是一个barcode(条型码)控件.
      

  2.   

    有没有高手会??????????
    up
    UP
    UPUP
    UPUPUP
      

  3.   

    我要的是:::::
    打印一个控件或者打印窗体的(X1,Y1)----(X2,Y2)
    printer.PaintPicture form1.image,0,0,,,1000,1000,1000,1000此方法打印窗体的IMAGE
    但是,我要打印的是窗体上的控件.
    (VB中打印一个控件好像需要此控件有支持打印的功能)不知道我有没有记错.
    请高手指点.....
      

  4.   

    控件command1,command2,picture1,把command1画在picture1中,然后打印Public Declare Function StretchBlt Lib "gdi32" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As LongPublic Const SRCCOPY = &HCC0020 ' (DWORD) dest = sourcePublic Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As LongPrivate Sub Command2_Click()
        Dim lReturn As Long
        Dim llhwnd As Long
        Picture1.Width = Command1.Width
        Picture1.Height = Command1.Height
        llhwnd = GetDC(Form1.hwnd)
        lReturn = StretchBlt(Picture1.hdc, _
                            0, 0, _
                            Picture1.Width / Screen.TwipsPerPixelX, _
                            Picture1.Height / Screen.TwipsPerPixelY, _
                        llhwnd, _
                            Command1.Left / Screen.TwipsPerPixelX, Command1.Top / Screen.TwipsPerPixelY, _
                            Command1.Width / Screen.TwipsPerPixelX, _
                            Command1.Height / Screen.TwipsPerPixelY, _
                        SRCCOPY)
        Picture1.Refresh
    End Sub
      

  5.   

    有些控件有打印的方法,直接用就可以打印上边数据,有的没有
    打印方法
    Printer.PaintPicture Picture1.Image, 0, 0
      

  6.   

    TO:skywolfY(莫愁) 
    不行,打不出(打出来是Picture1的表面,而没有打出上面的控件Command1)
    错....
      

  7.   

    能不能把窗口要打印那部分截取,作为Image送到Picture控件,再打印?
      

  8.   

    呵呵,什么错呀,是您有什么地方没用对吧,看看思路和,
    把Command1画在 picture1上
    还有,Picture1 的AutoRedraw设为True了吗?
    画在Picture1上的图能不能打出来?
    能打出来就没错
      

  9.   

    对了,上边的控件?你把Command1放哪了?
    Command1在Form1上
    Picture1在Form1上
      

  10.   

    TO : skywolfY(莫愁) 
    我知道....
    Picture控件中有图形
    Picture1.Refresh  后 '------------------Picture控件中没有任何图形
    把上一句注释掉后Picture有图形.
    Printer.PaintPicture Picture1.Image, 0, 0 打印出的是Picture控件的背景.而不是控件的图形.

    http://expert.csdn.net/Expert/topic/1292/1292883.xml?temp=.8203546
    两贴的分一起结.........等你来拿....
      

  11.   

    看看这个源代码
    http://www.aspbit.com/qprinter160.zip