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

📄 form1.frm

📁 本文件包含200个visual baisc实例
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "浏览大幅BMP图片-选择、查找"
   ClientHeight    =   3810
   ClientLeft      =   45
   ClientTop       =   420
   ClientWidth     =   5865
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3810
   ScaleWidth      =   5865
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  '所有者中心
   Begin VB.DirListBox Dir1 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   930
      Left            =   60
      TabIndex        =   4
      Top             =   360
      Width           =   5730
   End
   Begin VB.DriveListBox Drive1 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   300
      Left            =   60
      TabIndex        =   3
      Top             =   30
      Width           =   5730
   End
   Begin VB.TextBox Text1 
      BackColor       =   &H00C0C0C0&
      Height          =   330
      Left            =   825
      TabIndex        =   2
      Top             =   1470
      Width           =   3405
   End
   Begin VB.FileListBox File1 
      Appearance      =   0  'Flat
      BackColor       =   &H00FFFFFF&
      Height          =   1290
      Left            =   60
      TabIndex        =   1
      Top             =   1950
      Width           =   5670
   End
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      Height          =   315
      Left            =   3585
      TabIndex        =   0
      Top             =   3315
      Width           =   2175
   End
   Begin VB.Label Label2 
      ForeColor       =   &H80000002&
      Height          =   240
      Left            =   45
      TabIndex        =   6
      Top             =   3360
      Width           =   3435
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "图片检索                                       鼠标双击浏览图片 "
      Height          =   255
      Left            =   45
      TabIndex        =   5
      Top             =   1545
      Width           =   5745
   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()
  Dir1.Path = App.Path
  Drive1.Drive = Dir1.Path
  File1.Pattern = "*.bmp"   '设置文件列表框显示文件格式
End Sub

Private Sub Dir1_Change()        '选择文件夹
  File1.Path = Dir1.Path
  If File1.ListCount > 0 Then
     Label2.Caption = "共" & File1.ListCount & "个文件"   '获取bmp图片个数
     File1.Pattern = Text1.Text + "*.bmp"
    Else
     form2.Pview.Picture = LoadPicture("")
     Label2.Caption = ""
  End If
End Sub

Private Sub Drive1_Change()  '选择驱动器
  Dir1.Path = Drive1.Drive
End Sub
Private Sub File1_DblClick()
  Load form2
  form2.Show
  Form1.Enabled = False
  form2.Label1.Caption = Label2.Caption & " " & "第" & File1.ListIndex + 1 & "个文件"
  Dim sfilename As String
  Dim l As Long
  Dim dwidth As Long, dheight As Long
  If File1.ListCount <= 0 Then    '文件列表框如果没有图片,取消操作
     Exit Sub
  End If
  If Right(File1.Path, 1) <> "\" Then '判断选定文件
     sfilename = File1.Path & "\" & File1.FileName
   Else
     sfilename = File1.Path & File1.FileName
  End If
  form2.Pscroll.Picture = LoadPicture("")
  form2.Pscroll.Picture = LoadPicture(sfilename)  '导入选定图片显示
  If form2.Pscroll.Width < form2.Pview.ScaleWidth Then  '判断是否给图片加水平滚动条
     form2.Pscroll.Left = (form2.Pview.ScaleWidth - form2.Pscroll.Width) \ 2
     form2.HScpic.Visible = False
   Else
     form2.Pscroll.Left = 0
     form2.HScpic.Visible = True
     form2.HScpic.Value = 0
     On Error Resume Next
     form2.HScpic.Max = form2.Pscroll.Width - form2.Pview.ScaleWidth
     form2.HScpic.SmallChange = form2.Pscroll.Width \ 20
     form2.HScpic.LargeChange = form2.Pscroll.Width \ 10
  End If
  If form2.Pscroll.Height < form2.Pview.Height Then   '判断是否给图片加垂直滚动条
     form2.Pscroll.Top = (form2.Pview.ScaleHeight - form2.Pscroll.Height) \ 2
     form2.VScpic.Visible = True
   Else
     form2.Pscroll.Top = 0
     form2.VScpic.Visible = True
     form2.VScpic.Value = 0
     form2.VScpic.Max = form2.Pscroll.Height - form2.Pview.ScaleHeight
     form2.VScpic.SmallChange = form2.Pscroll.Height \ 20
     form2.VScpic.LargeChange = form2.Pscroll.Height \ 10
  End If
End Sub

Private Sub text1_Change()  '检索图片
  File1.Pattern = Text1.Text + "*.bmp"
  Label2.Caption = "文件数目:" & Str(File1.ListCount) & "个文件"
End Sub

Private Sub Command1_Click()
  Unload Me
End Sub

⌨️ 快捷键说明

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