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

📄 form1.frm

📁 这里有很多很实用的VB编程案例,方便大家学习VB.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "图片处理"
   ClientHeight    =   3735
   ClientLeft      =   3750
   ClientTop       =   1800
   ClientWidth     =   4365
   LinkTopic       =   "Form1"
   ScaleHeight     =   3735
   ScaleWidth      =   4365
   Begin VB.PictureBox Picture2 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      ForeColor       =   &H80000008&
      Height          =   975
      Left            =   600
      ScaleHeight     =   945
      ScaleWidth      =   1425
      TabIndex        =   3
      Top             =   480
      Width           =   1455
   End
   Begin VB.PictureBox Picture3 
      Height          =   855
      Left            =   2760
      Picture         =   "form1.frx":0000
      ScaleHeight     =   795
      ScaleWidth      =   795
      TabIndex        =   2
      Top             =   2400
      Visible         =   0   'False
      Width           =   855
   End
   Begin VB.ComboBox Combo1 
      ForeColor       =   &H000000FF&
      Height          =   300
      Left            =   600
      TabIndex        =   1
      Text            =   "    放大尺寸"
      Top             =   120
      Width           =   1575
   End
   Begin VB.PictureBox Picture1 
      Appearance      =   0  'Flat
      AutoRedraw      =   -1  'True
      BackColor       =   &H80000005&
      BorderStyle     =   0  'None
      FillColor       =   &H00FFFFFF&
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   9.75
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00800000&
      Height          =   2895
      Left            =   600
      ScaleHeight     =   2895
      ScaleWidth      =   3135
      TabIndex        =   0
      Top             =   480
      Width           =   3135
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim ZoomSize As Single

Private Function ZoomIt()
    Picture2.Height = Picture1.Height * ZoomSize
    Picture2.Width = Picture1.Width * ZoomSize
   
    Picture2.Cls
    Picture2.Visible = False
    Picture1.Visible = False
    Picture2.Visible = True

    Picture2.PaintPicture Picture1.Image, 0, 0, _
    Picture1.ScaleWidth * ZoomSize, Picture1.ScaleWidth * ZoomSize
    Me.Height = Picture2.Height + 1440
    Me.Width = Picture2.Width + 1440
End Function
Private Sub Combo1_Click()
    Select Case Combo1
        Case "      25%"
            ZoomSize = 0.25
            ZoomIt
        Case "      50%"
            ZoomSize = 0.5
            ZoomIt
        Case "      75%"
            ZoomSize = 0.75
            ZoomIt
        Case "     100%"
            ZoomSize = 1#
            ZoomIt
         Case "     150%"
            ZoomSize = 1.5
            ZoomIt
          Case "     200%"
            ZoomSize = 2#
            ZoomIt
    End Select
End Sub

Private Sub Command1_Click()
   
End Sub

Private Sub Form_Load()
    Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
    Combo1.AddItem "      25%"
    Combo1.AddItem "      50%"
    Combo1.AddItem "      75%"
    Combo1.AddItem "     100%"
    Combo1.AddItem "     150%"
    Combo1.AddItem "     200%"
    Picture2.Visible = False
    Picture1.PaintPicture Picture3.Picture, 1250, 1250
End Sub

⌨️ 快捷键说明

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