VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "VB6 例10-17a  百叶窗效果 "
   ClientHeight    =   2670
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   3900
   LinkTopic       =   "Form1"
   ScaleHeight     =   2670
   ScaleWidth      =   3900
   StartUpPosition =   3  '窗口缺省
   Begin VB.TextBox Text1 
      Height          =   270
      Left            =   1350
      TabIndex        =   4
      Text            =   "10"
      Top             =   2280
      Width           =   495
   End
   Begin VB.PictureBox Picture2 
      AutoRedraw      =   -1  'True
      Height          =   1995
      Left            =   600
      ScaleHeight     =   1935
      ScaleWidth      =   2715
      TabIndex        =   3
      Top             =   0
      Width           =   2775
   End
   Begin VB.PictureBox Picture1 
      AutoRedraw      =   -1  'True
      AutoSize        =   -1  'True
      BorderStyle     =   0  'None
      Height          =   1905
      Left            =   120
      Picture         =   "V6bj10-17a.frx":0000
      ScaleHeight     =   1905
      ScaleWidth      =   2790
      TabIndex        =   2
      Top             =   240
      Visible         =   0   'False
      Width           =   2790
   End
   Begin VB.CommandButton Command2 
      Caption         =   "垂直"
      Height          =   375
      Left            =   2940
      TabIndex        =   1
      Top             =   2280
      Width           =   855
   End
   Begin VB.CommandButton Command1 
      Caption         =   "水平"
      Height          =   375
      Left            =   1920
      TabIndex        =   0
      Top             =   2280
      Width           =   915
   End
   Begin VB.Label Label1 
      Caption         =   "每次读取的宽度"
      Height          =   255
      Left            =   30
      TabIndex        =   5
      Top             =   2280
      Width           =   1365
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub sleep(n As Integer)
    Dim i As Integer
    For i = 1 To n
    Next i
End Sub
Private Sub Command1_Click()
    Dim hstep, width2, height2, i, j, num As Long
    hstep = Val(Text1)                  '每次读取的宽度
    width2 = Picture1.ScaleWidth
    height2 = Picture1.ScaleHeight
    num = height2 / hstep                 '共有几行（列）
    Set Picture2.Picture = Nothing
    For i = 1 To num Step 2
        Picture2.PaintPicture Picture1, 0, i * hstep, width2, hstep, 0, i * hstep, width2, hstep
        DoEvents
        sleep (3000 * hstep)
    Next i
    For i = 0 To num - 1 Step 2
        Picture2.PaintPicture Picture1, 0, i * hstep, width2, hstep, 0, i * hstep, width2, hstep, vbSrcCopy
        DoEvents
        sleep (3000 * hstep)
    Next i
End Sub

Private Sub Command2_Click()
    Dim hstep, width2, height2, i, j, num As Long
    hstep = Val(Text1)                  '每次读取的宽度
    width2 = Picture1.ScaleWidth
    height2 = Picture1.ScaleHeight
    num = width2 / hstep                '共有几行（列）
    Set Picture2.Picture = Nothing
    For i = 1 To num - 1 Step 2
        Picture2.PaintPicture Picture1, i * hstep, 0, hstep, height2, i * hstep, 0, hstep, height2, vbSrcCopy
        DoEvents
        sleep (3000 * hstep)
    Next i
    For i = 0 To num Step 2
        Picture2.PaintPicture Picture1, i * hstep, 0, hstep, height2, i * hstep, 0, hstep, height2, vbSrcCopy
        DoEvents
        sleep (3000 * hstep)
    Next i
End Sub

Private Sub Form_Load()
    Picture2.Width = Picture1.Width
    Picture2.Height = Picture1.Height
End Sub
