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

📄 form1.frm

📁 很多的vb经典源代码
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "图片浏览器"
   ClientHeight    =   3375
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   5895
   LinkTopic       =   "Form1"
   ScaleHeight     =   225
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   393
   StartUpPosition =   3  'Windows Default
   Begin VB.VScrollBar VScroll1 
      Height          =   3135
      LargeChange     =   20
      Left            =   5640
      SmallChange     =   10
      TabIndex        =   3
      Top             =   0
      Width           =   255
   End
   Begin VB.HScrollBar HScroll1 
      Height          =   255
      LargeChange     =   20
      Left            =   0
      SmallChange     =   10
      TabIndex        =   2
      Top             =   3120
      Width           =   5655
   End
   Begin VB.PictureBox fatherPic 
      BorderStyle     =   0  'None
      Height          =   3015
      Left            =   0
      ScaleHeight     =   3015
      ScaleWidth      =   5535
      TabIndex        =   0
      Top             =   0
      Width           =   5535
      Begin VB.PictureBox SunPic 
         AutoSize        =   -1  'True
         BorderStyle     =   0  'None
         Height          =   1695
         Left            =   840
         ScaleHeight     =   1695
         ScaleWidth      =   2415
         TabIndex        =   1
         Top             =   360
         Width           =   2415
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private Sub Form_Load()
    '加载位图。
    SunPic.Picture = LoadPicture("c:\samples\p01.jpg")
    '初始化两个图片框的位置。
    fatherPic.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
    SunPic.Move 0, 0
    '将水平滚动条定位。
    HScroll1.Top = fatherPic.Height
    HScroll1.Left = 0
    HScroll1.Width = fatherPic.Width
    '将垂直滚动条定位。
    VScroll1.Top = 0
    VScroll1.Left = fatherPic.Width
    VScroll1.Height = fatherPic.Height
    '设置滚动条的 Max 属性。
    HScroll1.Max = SunPic.Width - fatherPic.Width
    VScroll1.Max = SunPic.Height - fatherPic.Height
    '判断子图片框是否将充满屏幕。
    '若如此,则无需使用滚动条。
    VScroll1.Visible = (fatherPic.Height < SunPic.Height)
    HScroll1.Visible = (fatherPic.Width < SunPic.Width)
End Sub

Private Sub Form_Resize()
    '调整窗体大小时,改变 Picture1
    '的尺寸。
    fatherPic.Height = Form1.ScaleHeight
    fatherPic.Width = Form1.ScaleWidth
    '重新初始化图片和滚动条的
    '位置。
    fatherPic.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
    SunPic.Move 0, 0
    HScroll1.Top = fatherPic.Height
    HScroll1.Left = 0
    HScroll1.Width = fatherPic.Width
    VScroll1.Top = 0
    VScroll1.Left = fatherPic.Width
    VScroll1.Height = fatherPic.Height
    HScroll1.Max = SunPic.Width - fatherPic.Width
    VScroll1.Max = SunPic.Height - fatherPic.Width

    '检查是否需要滚动条。
    VScroll1.Visible = (fatherPic.Height < SunPic.Height)
    HScroll1.Visible = (fatherPic.Width < SunPic.Width)

End Sub

Private Sub HScroll1_Change()
    SunPic.Left = -HScroll1.Value

End Sub

Private Sub HScroll1_Scroll()
SunPic.Left = -HScroll1.Value
End Sub

Private Sub VScroll1_Change()
SunPic.Top = -VScroll1.Value

End Sub

Private Sub VScroll1_Scroll()
SunPic.Top = -VScroll1.Value
End Sub

⌨️ 快捷键说明

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