VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form Form1 
   Caption         =   "图片浏览器"
   ClientHeight    =   4605
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5190
   LinkTopic       =   "Form1"
   ScaleHeight     =   4605
   ScaleWidth      =   5190
   StartUpPosition =   3  '窗口缺省
   Begin MSComctlLib.StatusBar StatusBar1 
      Align           =   2  'Align Bottom
      Height          =   375
      Left            =   0
      TabIndex        =   4
      Top             =   4230
      Width           =   5190
      _ExtentX        =   9155
      _ExtentY        =   661
      _Version        =   393216
      BeginProperty Panels {8E3867A5-8586-11D1-B16A-00C0F0283628} 
         NumPanels       =   1
         BeginProperty Panel1 {8E3867AB-8586-11D1-B16A-00C0F0283628} 
         EndProperty
      EndProperty
   End
   Begin VB.PictureBox Picture1 
      Height          =   3450
      Left            =   60
      ScaleHeight     =   3390
      ScaleWidth      =   4965
      TabIndex        =   1
      Top             =   780
      Width           =   5025
      Begin MSComDlg.CommonDialog CommonDialog1 
         Left            =   3000
         Top             =   360
         _ExtentX        =   847
         _ExtentY        =   847
         _Version        =   393216
      End
      Begin VB.HScrollBar HScroll1 
         Height          =   225
         Left            =   -15
         TabIndex        =   3
         Top             =   3150
         Width           =   4680
      End
      Begin VB.VScrollBar VScroll1 
         Height          =   3315
         Left            =   4650
         TabIndex        =   2
         Top             =   45
         Width           =   270
      End
      Begin VB.Image Image1 
         Height          =   2505
         Left            =   180
         Stretch         =   -1  'True
         Top             =   210
         Width           =   4125
      End
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   3765
      Top             =   135
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   24
      ImageHeight     =   24
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   5
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":08DC
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":11B8
            Key             =   ""
         EndProperty
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":1A94
            Key             =   ""
         EndProperty
         BeginProperty ListImage5 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "Form1.frx":1DB0
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.Toolbar Toolbar1 
      Align           =   1  'Align Top
      Height          =   735
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   5190
      _ExtentX        =   9155
      _ExtentY        =   1296
      ButtonWidth     =   820
      ButtonHeight    =   1138
      Appearance      =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   7
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "打开"
            Key             =   "Open"
            Description     =   "打开"
            Object.ToolTipText     =   "打开图片文件"
            ImageIndex      =   1
         EndProperty
         BeginProperty Button2 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button3 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "缩小"
            Key             =   "ZoomOut"
            Object.ToolTipText     =   "缩小图像"
            ImageIndex      =   2
         EndProperty
         BeginProperty Button4 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "放大"
            Key             =   "ZoomIn"
            Object.ToolTipText     =   "放大图像"
            ImageIndex      =   3
         EndProperty
         BeginProperty Button5 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "填充"
            Key             =   "Fill"
            ImageIndex      =   4
         EndProperty
         BeginProperty Button6 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Style           =   3
         EndProperty
         BeginProperty Button7 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "打印"
            Key             =   "Print"
            ImageIndex      =   5
         EndProperty
      EndProperty
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Form_Load()
'设置[打开]对话框过滤器
CommonDialog1.Filter = "JPG图像|*.jpg|BMP图像|*.bmp|GIF图像|*.gif|全部文件|*.*"
'初始化滚动条
VScroll1.Max = 100
VScroll1.LargeChange = 10
VScroll1.SmallChange = 2
HScroll1.Max = 100
HScroll1.LargeChange = 10
HScroll1.SmallChange = 2
'初始化状态栏
StatusBar1.Panels.Add (1)   '添加状态栏窗格
StatusBar1.Panels(1).AutoSize = sbrContents '设置窗格大小为自动
StatusBar1.Panels.Add (2)
StatusBar1.Panels.Add (3)
StatusBar1.Panels(3).Style = sbrTime    '在索引为3的窗格上显示时间
StatusBar1.Panels(3).Alignment = sbrRight   '窗格显示内容右对齐

Image1.Stretch = True   'Image控件内图形大小为可适应控件
End Sub

Private Sub Form_Resize()
    '当窗体大小改变时
    '改变PictureBox控件大小
    Picture1.Top = Toolbar1.Height
    Picture1.Left = 100
    Picture1.Height = Me.Height - 1500
    Picture1.Width = Me.Width - 300
    '改变垂直滚动条控件大小
    VScroll1.Top = 0
    VScroll1.Left = Picture1.Width - 300
    VScroll1.Width = 300
    VScroll1.Height = Picture1.Height
     '改变水平滚动条控件大小
    HScroll1.Top = Picture1.Height - 300
    HScroll1.Left = 0
    HScroll1.Width = Picture1.Width - 300
    HScroll1.Height = 300
     '改变Image控件大小
    Image1.Top = 0
    Image1.Left = 0
    Image1.Width = Picture1.Width - 300
    Image1.Height = Picture1.Height - 300

End Sub

Private Sub HScroll1_Change()
    '滚动时移动图片
   Image1.Left = -HScroll1.Value / HScroll1.Max * Image1.Width
End Sub

Private Sub VScroll1_Change()
     '滚动时移动图片
    Image1.Top = -VScroll1.Value / VScroll1.Max * Image1.Height
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    '当单工具栏按钮时
    Select Case Button.Key
    Case "Open"
        CommonDialog1.ShowOpen
        Image1.Picture = LoadPicture(CommonDialog1.FileName) '载入图片
        StatusBar1.Panels(1).Text = CommonDialog1.FileName  '设置状态栏窗格文本
    Case "ZoomOut"
        Image1.Width = Image1.Width / 2
        Image1.Height = Image1.Height / 2
        StatusBar1.Panels(2).Text = "缩小"      '设置状态栏窗格文本
    Case "ZoomIn"
        Image1.Width = Image1.Width * 2
        Image1.Height = Image1.Height * 2
        StatusBar1.Panels(2).Text = "放大"       '设置状态栏窗格文本
    Case "Fill"
        Image1.Height = Picture1.Width - 300
        Image1.Width = Picture1.Width - 300
        Image1.Top = 0
        Image1.Left = 0
        StatusBar1.Panels(2).Text = "填充"      '设置状态栏窗格文本
    Case "Print"
        Printer.PaintPicture Image1.Picture, 100, 100  '使用Printer对象打印图片
        Printer.EndDoc
         StatusBar1.Panels(2).Text = "打印"     '设置状态栏窗格文本
    End Select
    
End Sub
