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

📄 fnewsize.frm

📁 Visual Basic image processing. Mainly it occupies some filters to detect some prperties of image. Re
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmNewSize 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Choose New Size"
   ClientHeight    =   3075
   ClientLeft      =   5325
   ClientTop       =   2565
   ClientWidth     =   3990
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "fNewSize.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3075
   ScaleWidth      =   3990
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton cmdOK 
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   1440
      TabIndex        =   8
      Top             =   2640
      Width           =   1215
   End
   Begin VB.CommandButton cmdCancel 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   2700
      TabIndex        =   7
      Top             =   2640
      Width           =   1215
   End
   Begin VB.Frame Frame1 
      Caption         =   "Frame1"
      Height          =   2535
      Left            =   60
      TabIndex        =   0
      Top             =   60
      Width           =   3855
      Begin VB.OptionButton optStyle 
         Caption         =   "&Percent"
         Height          =   195
         Index           =   1
         Left            =   60
         TabIndex        =   13
         Top             =   1740
         Width           =   3615
      End
      Begin VB.OptionButton optStyle 
         Caption         =   "&Free"
         Height          =   195
         Index           =   0
         Left            =   60
         TabIndex        =   12
         Top             =   240
         Value           =   -1  'True
         Width           =   3615
      End
      Begin VB.CheckBox chkKeepProportion 
         Caption         =   "&Keep proportions"
         Height          =   255
         Left            =   360
         TabIndex        =   11
         Top             =   1260
         Width           =   3435
      End
      Begin VB.TextBox txtPercent 
         BackColor       =   &H8000000F&
         Height          =   315
         Left            =   1080
         Locked          =   -1  'True
         TabIndex        =   10
         Text            =   "100"
         Top             =   1980
         Width           =   1395
      End
      Begin VB.TextBox txtHeight 
         Height          =   315
         Left            =   1080
         TabIndex        =   4
         Text            =   "Text1"
         Top             =   840
         Width           =   1395
      End
      Begin VB.TextBox txtWidth 
         Height          =   315
         Left            =   1080
         TabIndex        =   1
         Text            =   "Text1"
         Top             =   480
         Width           =   1395
      End
      Begin VB.Label lblPercentage 
         Caption         =   "Percent:"
         Height          =   195
         Left            =   420
         TabIndex        =   9
         Top             =   2040
         Width           =   675
      End
      Begin VB.Label lblOrigHeight 
         Height          =   315
         Left            =   2520
         TabIndex        =   6
         Top             =   900
         Width           =   1275
      End
      Begin VB.Label lblHeight 
         Caption         =   "Height"
         Height          =   255
         Left            =   360
         TabIndex        =   5
         Top             =   900
         Width           =   615
      End
      Begin VB.Label lblOrigWidth 
         Height          =   315
         Left            =   2520
         TabIndex        =   3
         Top             =   540
         Width           =   1215
      End
      Begin VB.Label lbl 
         Caption         =   "Width:"
         Height          =   255
         Left            =   360
         TabIndex        =   2
         Top             =   540
         Width           =   615
      End
   End
End
Attribute VB_Name = "frmNewSize"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Private m_bCancelled As Boolean
Private m_lWIdth As Long
Private m_lHeight As Long
Private m_lOrigWidth As Long
Private m_lOrigHeight As Long

Public Sub SetSize(ByVal lW As Long, ByVal lH As Long)
    m_lOrigWidth = lW
    m_lOrigHeight = lH
End Sub

Public Property Get ImageWidth() As Long
    ImageWidth = m_lWIdth
End Property
Public Property Get ImageHeight() As Long
    ImageHeight = m_lHeight
End Property

Public Property Get Cancelled() As Boolean
    Cancelled = m_bCancelled
End Property

Private Sub EnableControls()
Dim bS As Boolean
Dim lC1 As Long, lC2 As Long
    lC2 = vbButtonFace: lC1 = vbWindowBackground
    bS = (optStyle(0).Value)
    txtWidth.Locked = Not (bS)
    txtWidth.BackColor = lC2
    txtHeight.Locked = Not (bS)
    txtHeight.BackColor = lC2
    chkKeepProportion.Enabled = bS
    txtPercent.Locked = bS
    txtPercent.BackColor = lC1
End Sub

Private Sub cmdCancel_Click()
    Unload Me
End Sub

Private Sub cmdOK_Click()
    m_lWIdth = CLng(txtWidth.Text)
    m_lHeight = CLng(txtHeight.Text)
    m_bCancelled = False
    Unload Me
End Sub

Private Sub Form_Load()
    m_bCancelled = True
    lblOrigWidth.Caption = m_lOrigWidth
    lblOrigHeight.Caption = m_lOrigHeight
    txtWidth.Text = m_lOrigWidth
    txtHeight.Text = m_lOrigHeight
End Sub

Private Sub optStyle_Click(Index As Integer)
    EnableControls
End Sub

Private Sub txtHeight_Change()
Dim l As Long
    If (chkKeepProportion.Value = Checked) Then
        If (txtHeight.Tag = "") Then
            If IsNumeric(txtHeight) Then
                l = CLng(txtHeight)
                txtWidth.Tag = "txtHeight"
                txtWidth.Text = l * CLng(lblOrigWidth.Caption) \ CLng(lblOrigHeight.Caption)
                txtWidth.Tag = ""
            End If
        End If
    End If

End Sub

Private Sub txtPercent_Change()
Dim l As Double
    If (optStyle(1).Value) Then
        If IsNumeric(txtPercent) Then
            l = CLng(txtPercent) / 100
            txtWidth.Text = CLng(CLng(lblOrigWidth.Caption) * l)
            txtHeight.Text = CLng(CLng(lblOrigHeight.Caption) * l)
        End If
    End If
End Sub

Private Sub txtWidth_Change()
Dim l As Long
    If (chkKeepProportion.Value = Checked) Then
        If txtWidth.Tag = "" Then
            If IsNumeric(txtWidth) Then
                l = CLng(txtWidth)
                txtHeight.Tag = "txtWidth"
                txtHeight.Text = l * CLng(lblOrigHeight.Caption) \ CLng(lblOrigWidth.Caption)
                txtHeight.Tag = ""
            End If
        End If
    End If
End Sub

⌨️ 快捷键说明

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