⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form2.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form form2 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "浏览大幅BMP图片-浏览"
   ClientHeight    =   8625
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   11910
   Icon            =   "form2.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   8625
   ScaleWidth      =   11910
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command3 
      Caption         =   "返回"
      Height          =   300
      Left            =   5235
      TabIndex        =   2
      Top             =   75
      Width           =   2475
   End
   Begin VB.CommandButton Command2 
      Caption         =   "下一页"
      Height          =   300
      Left            =   2640
      TabIndex        =   1
      Top             =   75
      Width           =   2475
   End
   Begin VB.CommandButton Command1 
      Caption         =   "上一页"
      Height          =   300
      Left            =   45
      TabIndex        =   0
      Top             =   75
      Width           =   2475
   End
   Begin VB.Frame Frame1 
      Height          =   8280
      Left            =   15
      TabIndex        =   3
      Top             =   360
      Width           =   11850
      Begin VB.HScrollBar HScpic 
         Height          =   255
         Left            =   45
         TabIndex        =   7
         Top             =   7950
         Width           =   11505
      End
      Begin VB.VScrollBar VScpic 
         Height          =   7740
         LargeChange     =   2000
         Left            =   11550
         TabIndex        =   6
         Top             =   150
         Width           =   255
      End
      Begin VB.PictureBox Pview 
         AutoSize        =   -1  'True
         BackColor       =   &H80000007&
         Height          =   7755
         Left            =   60
         ScaleHeight     =   7695
         ScaleWidth      =   11400
         TabIndex        =   4
         Top             =   150
         Width           =   11460
         Begin VB.PictureBox Pscroll 
            Appearance      =   0  'Flat
            AutoSize        =   -1  'True
            BackColor       =   &H80000006&
            ForeColor       =   &H80000008&
            Height          =   4350
            Left            =   45
            ScaleHeight     =   4320
            ScaleWidth      =   3285
            TabIndex        =   5
            Top             =   45
            Width           =   3315
         End
      End
   End
   Begin VB.Label Label1 
      Height          =   240
      Left            =   7800
      TabIndex        =   8
      Top             =   135
      Width           =   4050
   End
End
Attribute VB_Name = "form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub HScpic_Change()   '托动水平滚动条
  Pscroll.Left = -HScpic.Value
End Sub

Private Sub VScpic_Change()   '托动垂直滚动条
  Pscroll.Top = -VScpic.Value
End Sub

Private Sub Command1_Click()
  If Form1.File1.ListIndex > 0 Then
     On Error Resume Next
     Form1.File1.ListIndex = Form1.File1.ListIndex - 1
     Label1.Caption = Form1.Label2.Caption & " " & "第" & Form1.File1.ListIndex + 1 & "个文件"
     Dim sfilename As String
     Dim dwidth As Long, dheight As Long
     If Right(Form1.File1.Path, 1) <> "\" Then  '判断文件路径
        sfilename = Form1.File1.Path & "\" & Form1.File1.FileName
      Else
        sfilename = Form1.File1.Path & Form1.File1.FileName
     End If
     Pscroll.Picture = LoadPicture("")
     On Error Resume Next
     Pscroll.Picture = LoadPicture(sfilename)    '导入图片
     If Pscroll.Width < Pview.ScaleWidth Then    '设置水平滚动条
        Pscroll.Left = (Pview.ScaleWidth - Pscroll.Width) \ 2
        HScpic.Visible = False
       Else
        Pscroll.Left = 0
        HScpic.Visible = True
        HScpic.Value = 0
        On Error Resume Next
        HScpic.Max = Pscroll.Width - Pview.ScaleWidth
        HScpic.SmallChange = Pscroll.Width \ 20
        HScpic.LargeChange = Pscroll.Width \ 10
     End If
     If Pscroll.Height < Pview.Height Then     '设置垂直滚动条
        Pscroll.Top = (Pview.ScaleHeight - Pscroll.Height) \ 2
        VScpic.Visible = True
       Else
        Pscroll.Top = 0
        VScpic.Visible = True
        VScpic.Value = 0
        VScpic.Max = Pscroll.Height - Pview.ScaleHeight
        VScpic.SmallChange = Pscroll.Height \ 20
        VScpic.LargeChange = Pscroll.Height \ 10
     End If
   Else
    Exit Sub
  End If
End Sub

Private Sub Command2_Click()
  If Form1.File1.ListCount > Form1.File1.ListIndex + 1 Then
     On Error Resume Next
     Form1.File1.ListIndex = Form1.File1.ListIndex + 1
     Label1.Caption = Form1.Label2.Caption & " " & "第" & Form1.File1.ListIndex + 1 & "个文件"
     Dim sfilename As String
     Dim dwidth As Long, dheight As Long
     If Right(Form1.File1.Path, 1) <> "\" Then  '判断图片路径
        sfilename = Form1.File1.Path & "\" & Form1.File1.FileName
       Else
        sfilename = Form1.File1.Path & Form1.File1.FileName
     End If
     Pscroll.Picture = LoadPicture("")
     On Error Resume Next
     Pscroll.Picture = LoadPicture(sfilename)
     If Pscroll.Width < Pview.ScaleWidth Then   '设置水平滚动条
        Pscroll.Left = (Pview.ScaleWidth - Pscroll.Width) \ 2
        HScpic.Visible = False
       Else
        Pscroll.Left = 0
        HScpic.Visible = True
        HScpic.Value = 0
        On Error Resume Next
        HScpic.Max = Pscroll.Width - Pview.ScaleWidth
        HScpic.SmallChange = Pscroll.Width \ 20
        HScpic.LargeChange = Pscroll.Width \ 10
     End If
     If Pscroll.Height < Pview.Height Then     '设置垂直滚动条
        Pscroll.Top = (Pview.ScaleHeight - Pscroll.Height) \ 2
        VScpic.Visible = True
       Else
        Pscroll.Top = 0
        VScpic.Visible = True
        VScpic.Value = 0
        VScpic.Max = Pscroll.Height - Pview.ScaleHeight
        VScpic.SmallChange = Pscroll.Height \ 20
        VScpic.LargeChange = Pscroll.Height \ 10
     End If
   Else
     Exit Sub
  End If
End Sub

Private Sub Command3_Click()  '返回主窗体
  Form1.Enabled = True
  Unload Me
End Sub

Private Sub Form_Unload(Cancel As Integer)
  Form1.Enabled = True
End Sub




⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -