flip.frm

来自「大量优秀的vb编程」· FRM 代码 · 共 79 行

FRM
79
字号
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "翻转图像"
   ClientHeight    =   6384
   ClientLeft      =   60
   ClientTop       =   348
   ClientWidth     =   7752
   LinkTopic       =   "Form1"
   ScaleHeight     =   6384
   ScaleWidth      =   7752
   StartUpPosition =   3  '窗口缺省
   Begin VB.CommandButton Command1 
      Caption         =   "垂直翻转"
      Height          =   495
      Index           =   1
      Left            =   1680
      TabIndex        =   2
      Top             =   5880
      Width           =   1215
   End
   Begin VB.CommandButton Command1 
      Caption         =   "水平翻转"
      Height          =   495
      Index           =   0
      Left            =   3960
      TabIndex        =   1
      Top             =   5880
      Width           =   1215
   End
   Begin VB.PictureBox Picture1 
      AutoSize        =   -1  'True
      Height          =   5808
      Left            =   0
      Picture         =   "Flip.frx":0000
      ScaleHeight     =   5760
      ScaleWidth      =   7680
      TabIndex        =   0
      Top             =   0
      Width           =   7728
   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 bHort As Boolean
Dim bVert As Boolean
Private Sub Command1_Click(Index As Integer)
    Dim pic As StdPicture
    
    Set pic = Picture1.Picture
   
    Picture1.Cls
    Select Case Index
        Case 0
            bHort = Not bHort
        Case 1
            bVert = Not bVert
    End Select
    
    If bHort And bVert Then
        Picture1.PaintPicture pic, Picture1.Width, Picture1.Height, _
            Picture1.Width * -1, Picture1.Height * -1
    ElseIf bHort And Not bVert Then
        Picture1.PaintPicture pic, Picture1.Width, 0, _
            Picture1.Width * -1, Picture1.Height
    ElseIf Not bHort And bVert Then
        Picture1.PaintPicture pic, 0, Picture1.Height, _
            Picture1.Width, Picture1.Height * -1
    Else
        Picture1.PaintPicture pic, 0, 0
    End If
End Sub

⌨️ 快捷键说明

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