用不着stretchblt,用picturebox.paintpicture就行了。

解决方案 »

  1.   

    参考如下程序,保存为form1.frm。VERSION 5.00
    Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "Comdlg32.ocx"
    Begin VB.Form Form1 
       Caption         =   "Form1"
       ClientHeight    =   5040
       ClientLeft      =   60
       ClientTop       =   345
       ClientWidth     =   7635
       LinkTopic       =   "Form1"
       ScaleHeight     =   5040
       ScaleWidth      =   7635
       StartUpPosition =   3  'Windows Default
       Begin MSComDlg.CommonDialog dlg 
          Left            =   4950
          Top             =   885
          _ExtentX        =   847
          _ExtentY        =   847
          _Version        =   393216
       End
       Begin VB.CommandButton Command1 
          Caption         =   "open"
          Height          =   465
          Left            =   2130
          TabIndex        =   4
          Top             =   1830
          Width           =   870
       End
       Begin VB.VScrollBar VScroll1 
          Height          =   1185
          Left            =   1800
          TabIndex        =   3
          Top             =   195
          Width           =   225
       End
       Begin VB.HScrollBar HScroll1 
          Height          =   255
          Left            =   90
          TabIndex        =   2
          Top             =   1785
          Width           =   1695
       End
       Begin VB.PictureBox Picture2 
          Height          =   1080
          Left            =   2250
          ScaleHeight     =   1020
          ScaleWidth      =   1170
          TabIndex        =   1
          Top             =   255
          Width           =   1230
       End
       Begin VB.PictureBox Picture1 
          Height          =   1560
          Left            =   90
          ScaleHeight     =   1500
          ScaleWidth      =   1560
          TabIndex        =   0
          Top             =   135
          Width           =   1620
       End
    End
    Attribute VB_Name = "Form1"
    Attribute VB_GlobalNameSpace = False
    Attribute VB_Creatable = False
    Attribute VB_PredeclaredId = True
    Attribute VB_Exposed = False
    Option ExplicitPrivate Sub Command1_Click()
        On Error GoTo errhandle
        Dim w As Long
        Dim h As Long
        dlg.Filter = "标准图片|*.bmp"
        dlg.ShowOpen
        Dim f As Integer
        f = FreeFile
        Open dlg.FileName For Binary As #f
        Get #f, 19, w
        Get #f, , h
        Close #f
        Picture2.Width = w * 15
        Picture2.Height = h * 15
        Picture2.Picture = LoadPicture(dlg.FileName)
        If w * 15 > Picture1.Width Then
            HScroll1.Value = 0
            HScroll1.Max = w * 15 - Picture1.Width
        Else
            HScroll1.Visible = False
        End If
        If h * 15 > Picture1.Height Then
            VScroll1.Value = 0
            VScroll1.Max = h * 15 - Picture1.Height
        Else
            VScroll1.Visible = False
        End If
        Picture1.Cls
        Picture1.PaintPicture Picture2.Picture, 0, 0
        HScroll1.Value = 0
        VScroll1.Value = 0
        Exit Sub
    errhandle:
        Debug.Print Error(Err.Number)
        Err.Clear
    End SubPrivate Sub Form_Load()
        With Me
            .Width = 230 * 15
            .Height = 280 * 15
        End With
        
        With Picture1
            .Left = 0
            .Top = 0
            .Width = 200 * 15
            .Height = 200 * 15
        End With
        With HScroll1
            .Left = 0
            .Top = Picture1.Height
            .Width = Picture1.Width
            .Height = 16 * 15
            '.Visible = False
        End With
        With VScroll1
            .Left = Picture1.Width
            .Top = 0
            .Height = Picture1.Height
            .Width = 16 * 15
            '.Visible = False
        End With
        With Picture2
            .Visible = False
            .AutoRedraw = True
        End With
        With Command1
            .Left = 0
            .Top = Picture1.Height + HScroll1.Height
        End With
    End SubPrivate Sub HScroll1_Change()
        Picture1.PaintPicture Picture2.Picture, -HScroll1.Value, -VScroll1.ValueEnd SubPrivate Sub HScroll1_Scroll()
        Picture1.PaintPicture Picture2.Picture, -HScroll1.Value, -VScroll1.Value
    End SubPrivate Sub VScroll1_Change()
        Picture1.PaintPicture Picture2.Picture, -HScroll1.Value, -VScroll1.ValueEnd SubPrivate Sub VScroll1_Scroll()
        Picture1.PaintPicture Picture2.Picture, -HScroll1.Value, -VScroll1.ValueEnd Sub
      

  2.   

    我的对象不是Picture,是我用Line画出来的线
      

  3.   

    我写的这段代码没有多大问题,因为基本是上是抄的一个例程,但是就是达不到跟例程一样的效果,是不是属性设置上还有什么特殊的地方,我的PictureBox的属性设置这些:
    Me.ScaleMode = 3
    Me.AutoRedraw = True 
    picFHR.ScaleMode = 3
    picFHR.AutoRedraw = True
    picFHR.AutoSize = True