我用bitblt函数截取图像放入picturebox控件中,可是在打印的时候出现问题,picture中的图像比纸大,打不全,该怎么解决啊?一直都找不到合适的方法

解决方案 »

  1.   

    Private Sub Zoom(ByVal Pic As PictureBox, ByVal ratio As Single)
        Dim SaveMode As Integer    SaveMode = Pic.ScaleMode    Shape1.BorderStyle = 3
        flag1 = False
        
        PicClip1.Picture = Picture2.Picture    PicClip1.ClipX = 0
        PicClip1.ClipY = 0
        PicClip1.ClipHeight = PicClip1.Height
        PicClip1.ClipWidth = PicClip1.Width    Pic.Left = Pic.Left + Pic.Width / 2 - Pic.Width * ratio / 2
        Pic.Top = Pic.Top + Pic.Height / 2 - Pic.Height * ratio / 2
        Pic.Width = Pic.Width * ratio
        Pic.Height = Pic.Height * ratio    Pic.ScaleMode = 3    PicClip1.StretchX = Pic.ScaleWidth
        PicClip1.StretchY = Pic.ScaleHeight    Pic.Picture = PicClip1.Clip    Pic.ScaleMode = SaveModeEnd Sub
      

  2.   


       BitBlt Picture1.hdc, 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight, hdc, 0, 155, &HCC0020    '截图
       Printer.PaintPicture Picture1.Image, Picture1.Left, Picture1.Top, Form5.Width, Picture1.Height  ’输出
         ommonDialog1.CancelError = True
         On Error GoTo ErrHandler
        CommonDialog1.ShowPrinter
      

  3.   

    Private Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (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 Long