📄 frmrgb.frm
字号:
VERSION 5.00
Begin VB.Form frmRGB
BorderStyle = 3 'Fixed Dialog
Caption = "RGB颜色调整"
ClientHeight = 2640
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4470
Icon = "frmRGB.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 4470
ShowInTaskbar = 0 'False
Begin VB.Frame Frame3
Height = 1890
Left = 120
TabIndex = 2
Top = 60
Width = 4215
Begin VB.CommandButton Command3
Caption = "复原"
Height = 375
Left = 3015
TabIndex = 14
Top = 1320
Width = 1020
End
Begin VB.CommandButton Command2
Caption = "预览"
Default = -1 'True
Height = 375
Left = 1485
TabIndex = 13
Top = 1320
Width = 1335
End
Begin VB.CheckBox Check1
Caption = "实时预览"
Height = 375
Left = 360
TabIndex = 12
Top = 1320
Value = 1 'Checked
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 3345
TabIndex = 8
Text = " 0"
Top = 285
Width = 675
End
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 3345
TabIndex = 7
Text = " 0"
Top = 570
Width = 675
End
Begin VB.TextBox Text3
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 240
Left = 3330
TabIndex = 6
Text = " 0"
Top = 855
Width = 675
End
Begin VB.HScrollBar HScroll1
Height = 240
Left = 375
Max = 255
Min = -255
TabIndex = 5
Top = 285
Width = 2925
End
Begin VB.HScrollBar HScroll2
Height = 240
Left = 375
Max = 255
Min = -255
TabIndex = 4
Top = 570
Width = 2925
End
Begin VB.HScrollBar HScroll3
Height = 240
Left = 375
Max = 255
Min = -255
TabIndex = 3
Top = 855
Width = 2925
End
Begin VB.Label Label7
Caption = "R:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 180
TabIndex = 11
Top = 330
Width = 285
End
Begin VB.Label Label10
Caption = "G:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 180
TabIndex = 10
Top = 600
Width = 285
End
Begin VB.Label Label11
Caption = "B:"
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 225
Left = 180
TabIndex = 9
Top = 870
Width = 285
End
End
Begin VB.CommandButton CancelButton
Cancel = -1 'True
Caption = "取消"
Height = 375
Left = 2565
TabIndex = 1
Top = 2100
Width = 1275
End
Begin VB.CommandButton OKButton
Caption = "确定"
Height = 375
Left = 1005
TabIndex = 0
Top = 2100
Width = 1275
End
End
Attribute VB_Name = "frmRGB"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub CancelButton_Click()
'取消设置
'还原成原来的数据
PicLeng = SetBitmapBits(frmMain.Picture2.Image.Handle, PicLeng, PicDataOld(0))
frmMain.Picture1.PaintPicture frmMain.Picture2.Image, 0, 0, _
frmMain.Picture1.ScaleWidth, frmMain.Picture1.ScaleHeight, _
0, _
0, frmMain.Picture2.ScaleWidth, _
frmMain.Picture2.ScaleHeight, &HCC0020
'Unload Me
Me.Hide
End Sub
Private Sub Check1_Click()
'按设置的RGB改变量,调整图像的RGB值
Call Command2_Click
End Sub
Private Sub Command2_Click()
'按设置的RGB改变量,调整图像的RGB值
Dim RGBTimeNew As Double
RGBTimeNew = Rnd(1) * Timer '为了防止以前的本过程继续运行
RGBTime = RGBTimeNew '为了防止以前的本过程继续运行
'+++++++++++++调整RGB值 +++++++++++++++
Call EditRGB(PicDataOld, PicDataNew, PicLeng, PicBit, _
Me.HScroll1.Value, Me.HScroll2.Value, Me.HScroll3.Value, _
RGBTimeNew)
DoEvents
If RGBTimeNew <> RGBTime Then '为了防止以前的本过程继续运行
Exit Sub
End If
'将修改以后的图像数据更新图像
PicLeng = SetBitmapBits(frmMain.Picture2.Image.Handle, PicLeng, PicDataNew(0))
frmMain.Picture1.PaintPicture frmMain.Picture2.Image, 0, 0, _
frmMain.Picture1.ScaleWidth, frmMain.Picture1.ScaleHeight, _
0, _
0, frmMain.Picture2.ScaleWidth, _
frmMain.Picture2.ScaleHeight, &HCC0020
End Sub
Private Sub Command3_Click()
Me.Text1.Text = " 0"
Me.Text2.Text = " 0"
Me.Text3.Text = " 0"
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Call CancelButton_Click
End Sub
Private Sub HScroll1_Change()
If Me.HScroll1.Value <> Val(Me.Text1.Text) Then
Me.Text1.Text = Str(Me.HScroll1.Value)
End If
End Sub
Private Sub HScroll1_Scroll()
If Me.HScroll1.Value <> Val(Me.Text1.Text) Then
Me.Text1.Text = Str(Me.HScroll1.Value)
End If
End Sub
Private Sub HScroll2_Change()
If Me.HScroll2.Value <> Val(Me.Text2.Text) Then
Me.Text2.Text = Str(Me.HScroll2.Value)
End If
End Sub
Private Sub HScroll2_Scroll()
If Me.HScroll2.Value <> Val(Me.Text2.Text) Then
Me.Text2.Text = Str(Me.HScroll2.Value)
End If
End Sub
Private Sub HScroll3_Change()
If Me.HScroll3.Value <> Val(Me.Text3.Text) Then
Me.Text3.Text = Str(Me.HScroll3.Value)
End If
End Sub
Private Sub HScroll3_Scroll()
If Me.HScroll3.Value <> Val(Me.Text3.Text) Then
Me.Text3.Text = Str(Me.HScroll3.Value)
End If
End Sub
Private Sub OKButton_Click()
'确定更改
Call Command2_Click
'Unload Me
Me.Hide
End Sub
Private Sub Text1_Change()
On Error GoTo aaa:
If Me.HScroll1.Value <> Val(Me.Text1.Text) Then
Me.HScroll1.Value = Val(Me.Text1.Text)
End If
If Me.Check1.Value <> 0 Then
Call Command2_Click
End If
Exit Sub
aaa:
Me.Text1.Text = " 0"
End Sub
Private Sub Text1_GotFocus()
Me.Text1.SelStart = 0
Me.Text1.SelLength = Len(Me.Text1.Text)
End Sub
Private Sub Text2_GotFocus()
Me.Text2.SelStart = 0
Me.Text2.SelLength = Len(Me.Text2.Text)
End Sub
Private Sub Text3_GotFocus()
Me.Text3.SelStart = 0
Me.Text3.SelLength = Len(Me.Text3.Text)
End Sub
Private Sub Text2_Change()
On Error GoTo aaa:
If Me.HScroll2.Value <> Val(Me.Text2.Text) Then
Me.HScroll2.Value = Val(Me.Text2.Text)
End If
If Me.Check1.Value <> 0 Then Call Command2_Click
Exit Sub
aaa:
Me.Text2.Text = " 0"
End Sub
Private Sub Text3_Change()
On Error GoTo aaa:
If Me.HScroll3.Value <> Val(Me.Text3.Text) Then
Me.HScroll3.Value = Val(Me.Text3.Text)
End If
If Me.Check1.Value <> 0 Then Call Command2_Click
Exit Sub
aaa:
Me.Text3.Text = " 0"
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, 68, 69, 100, 101, 8
Exit Sub
End Select
If KeyAscii > 47 And KeyAscii < 58 Then Exit Sub
KeyAscii = 0
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, 68, 69, 100, 101, 8
Exit Sub
End Select
If KeyAscii > 47 And KeyAscii < 58 Then Exit Sub
KeyAscii = 0
End Sub
Private Sub Text3_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, 68, 69, 100, 101, 8
Exit Sub
End Select
If KeyAscii > 47 And KeyAscii < 58 Then Exit Sub
KeyAscii = 0
End Sub
Private Sub Text4_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case 45, 46, 68, 69, 100, 101, 8
Exit Sub
End Select
If KeyAscii > 47 And KeyAscii < 58 Then Exit Sub
KeyAscii = 0
End Sub
'=======================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -