📄 fcombination.frm
字号:
VERSION 5.00
Begin VB.Form frmCombination
BorderStyle = 3 'Fixed Dialog
Caption = "Image Combination"
ClientHeight = 3390
ClientLeft = 6285
ClientTop = 4260
ClientWidth = 4980
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Icon = "fCombination.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3390
ScaleWidth = 4980
ShowInTaskbar = 0 'False
StartUpPosition = 1 'CenterOwner
Begin VB.OptionButton optCombine
Caption = "&Lightest"
Height = 195
Index = 2
Left = 60
TabIndex = 18
Top = 2100
Width = 4815
End
Begin VB.OptionButton optCombine
Caption = "&Darkest"
Height = 195
Index = 1
Left = 60
TabIndex = 17
Top = 1860
Width = 4815
End
Begin VB.OptionButton optCombine
Caption = "&Add Images"
Height = 195
Index = 0
Left = 60
TabIndex = 16
Top = 780
Value = -1 'True
Width = 4815
End
Begin VB.CommandButton cmdOK
Caption = "OK"
Default = -1 'True
Height = 375
Left = 2340
TabIndex = 15
Top = 2940
Width = 1275
End
Begin VB.CommandButton cmdCancel
Cancel = -1 'True
Caption = "Cancel"
Height = 375
Left = 3660
TabIndex = 14
Top = 2940
Width = 1275
End
Begin VB.Frame fraSep
Height = 75
Left = 0
TabIndex = 13
Top = 2760
Width = 4995
End
Begin VB.TextBox txtMultiplier
Height = 285
Index = 1
Left = 3360
TabIndex = 11
Tag = "Add"
Text = "1"
Top = 1380
Width = 1515
End
Begin VB.TextBox txtOffset
Height = 285
Index = 1
Left = 3360
TabIndex = 10
Tag = "Add"
Text = "0"
Top = 1020
Width = 1515
End
Begin VB.TextBox txtMultiplier
Height = 285
Index = 0
Left = 840
TabIndex = 7
Tag = "Add"
Text = "1"
Top = 1380
Width = 1515
End
Begin VB.TextBox txtOffset
Height = 285
Index = 0
Left = 840
TabIndex = 6
Tag = "Add"
Text = "0"
Top = 1020
Width = 1515
End
Begin VB.ComboBox cboSource
Height = 315
Index = 1
Left = 2580
Style = 2 'Dropdown List
TabIndex = 3
Top = 300
Width = 2295
End
Begin VB.ComboBox cboSource
Height = 315
Index = 0
Left = 60
Style = 2 'Dropdown List
TabIndex = 2
Top = 300
Width = 2295
End
Begin VB.Label lblInfo
Height = 255
Left = 60
TabIndex = 12
Top = 2520
Width = 4815
End
Begin VB.Label lblMultiplier
Caption = "Multiplier:"
Height = 255
Index = 1
Left = 2580
TabIndex = 9
Tag = "Add"
Top = 1440
Width = 975
End
Begin VB.Label lblOffset
Caption = "Offset:"
Height = 255
Index = 1
Left = 2580
TabIndex = 8
Tag = "Add"
Top = 1080
Width = 975
End
Begin VB.Label lblMultiplier
Caption = "Multiplier:"
Height = 255
Index = 0
Left = 60
TabIndex = 5
Tag = "Add"
Top = 1440
Width = 975
End
Begin VB.Label lblOffset
Caption = "Offset:"
Height = 255
Index = 0
Left = 60
TabIndex = 4
Tag = "Add"
Top = 1080
Width = 975
End
Begin VB.Label lblSource
Caption = "Source Image &2:"
Height = 255
Index = 1
Left = 2580
TabIndex = 1
Top = 60
Width = 1875
End
Begin VB.Label lblSource
Caption = "Source Image &1:"
Height = 255
Index = 0
Left = 60
TabIndex = 0
Top = 60
Width = 1875
End
End
Attribute VB_Name = "frmCombination"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private m_bCancel As Boolean
Private m_iOpt As Long
Private m_iOffset(1 To 2) As Long
Private m_iMultiplier(1 To 2) As Long
Private m_lNewImageWidth As Long
Private m_lNewImageHeight As Long
Private m_lImageSource(1 To 2) As Long
Public Enum ECombinationTypeConstants
eAdd = 1
eLightest = 2
eDarkest = 3
End Enum
Public Property Get CombinationType() As ECombinationTypeConstants
CombinationType = m_iOpt
End Property
Public Property Get Offset(ByVal lIndex As Long)
Offset = m_iOffset(lIndex)
End Property
Public Property Get Multiplier(ByVal lIndex As Long)
Multiplier = m_iMultiplier(lIndex)
End Property
Public Property Get Cancelled() As Boolean
Cancelled = m_bCancel
End Property
Public Property Get ImageSource(ByVal lIndex As Long) As Long
ImageSource = m_lImageSource(lIndex)
End Property
Public Property Get NewImageWidth() As Long
NewImageWidth = m_lNewImageWidth
End Property
Public Property Get NewImageHeight() As Long
NewImageHeight = m_lNewImageHeight
End Property
Private Sub cboSource_Click(Index As Integer)
Dim lW1 As Long, lH1 As Long
Dim lW2 As Long, lH2 As Long
If (cboSource(Index).Tag = "") Then
lW1 = Forms(cboSource(0).ItemData(cboSource(0).ListIndex)).ImageWidth
lH1 = Forms(cboSource(0).ItemData(cboSource(0).ListIndex)).ImageHeight
lW2 = Forms(cboSource(1).ItemData(cboSource(1).ListIndex)).ImageWidth
lH2 = Forms(cboSource(1).ItemData(cboSource(1).ListIndex)).ImageHeight
If (lW1 > lW2) Then
m_lNewImageWidth = lW2
Else
m_lNewImageWidth = lW1
End If
If (lH1 > lH2) Then
m_lNewImageHeight = lH2
Else
m_lNewImageHeight = lH1
End If
lblInfo.Caption = "Output image size: " & m_lNewImageWidth & " x " & m_lNewImageHeight
End If
m_lImageSource(Index + 1) = cboSource(Index).ItemData(cboSource(Index).ListIndex)
End Sub
Private Sub cmdCancel_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
On Error GoTo ValFail
m_iOpt = -1 * (optCombine(0).Value + 2 * optCombine(1).Value + 3 * optCombine(2).Value)
If (m_iOpt > 0) Then
m_iOffset(1) = CLng(txtOffset(0))
m_iOffset(2) = CLng(txtOffset(1))
m_iMultiplier(1) = CLng(txtMultiplier(0))
m_iMultiplier(2) = CLng(txtMultiplier(1))
End If
Unload Me
m_bCancel = False
Exit Sub
ValFail:
MsgBox "Error in entries.", vbInformation
Exit Sub
End Sub
Private Sub Form_Load()
Dim iFrm As Long
Dim sItem As String
Dim i As Long
m_bCancel = True
For iFrm = 0 To Forms.Count - 1
If Forms(iFrm).Name = "frmImage" Then
sItem = Forms(iFrm).FileTitle
With cboSource(0)
.AddItem sItem
.ItemData(.NewIndex) = iFrm
End With
With cboSource(1)
.AddItem sItem
.ItemData(.NewIndex) = iFrm
End With
End If
Next iFrm
cboSource(0).Tag = "DONT"
cboSource(0).ListIndex = 0
cboSource(0).Tag = ""
cboSource(1).ListIndex = Abs(cboSource(1).ListCount > 1)
End Sub
Private Sub optCombine_Click(Index As Integer)
Dim i As Long
Dim sTag As String
For i = 0 To Me.Controls.Count - 1
On Error Resume Next
sTag = Me.Controls(i).Tag
If (Err.Number = 0) Then
If (sTag = "Add") Then
Me.Controls(i).Enabled = optCombine(0).Value
End If
End If
Next i
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -