📄 nihongdeng8.frm
字号:
VERSION 5.00
Begin VB.Form Form8
BorderStyle = 1 'Fixed Single
Caption = "灯管颜色设置"
ClientHeight = 3435
ClientLeft = 4545
ClientTop = 840
ClientWidth = 2775
ControlBox = 0 'False
LinkTopic = "Form8"
MaxButton = 0 'False
MinButton = 0 'False
Moveable = 0 'False
ScaleHeight = 3435
ScaleWidth = 2775
Begin VB.CommandButton Command4
Caption = "退出"
Height = 420
Left = 225
TabIndex = 6
Top = 2925
Width = 2310
End
Begin VB.CommandButton Command3
Caption = "应用"
Height = 420
Left = 225
TabIndex = 5
Top = 2430
Width = 2310
End
Begin VB.CommandButton Command2
Caption = "恢复缺省值"
Height = 420
Left = 225
TabIndex = 4
Top = 1935
Width = 2310
End
Begin VB.CommandButton Command1
Caption = "设置颜色"
Height = 420
Left = 225
TabIndex = 3
Top = 1440
Width = 2310
End
Begin VB.OptionButton Option1
Caption = "灯管颜色3:"
Height = 330
Index = 2
Left = 225
TabIndex = 2
Top = 900
Width = 1320
End
Begin VB.OptionButton Option1
Caption = "灯管颜色2:"
Height = 330
Index = 1
Left = 225
TabIndex = 1
Top = 540
Width = 1320
End
Begin VB.OptionButton Option1
Caption = "灯管颜色1:"
Height = 330
Index = 0
Left = 225
TabIndex = 0
Top = 180
Value = -1 'True
Width = 1320
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
BackStyle = 1 'Opaque
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 135
Index = 2
Left = 1620
Top = 990
Width = 930
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
BackStyle = 1 'Opaque
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 135
Index = 1
Left = 1620
Top = 630
Width = 930
End
Begin VB.Shape Shape1
BackColor = &H000000FF&
BackStyle = 1 'Opaque
BorderColor = &H000000FF&
FillColor = &H000000FF&
Height = 135
Index = 0
Left = 1620
Top = 270
Width = 930
End
End
Attribute VB_Name = "Form8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim TempDengGuanColor1 As Long
Dim TempDengGuanColor2 As Long
Dim TempDengGuanColor3 As Long
Private Sub Command1_Click()
If Form8.Option1(0).Value = True Then
Form1.CommonDialog1.Color = TempDengGuanColor1
End If
If Form8.Option1(1).Value = True Then
Form1.CommonDialog1.Color = TempDengGuanColor2
End If
If Form8.Option1(2).Value = True Then
Form1.CommonDialog1.Color = TempDengGuanColor3
End If
' 设置“取消”为True
Form1.CommonDialog1.CancelError = True
On Error GoTo ErrHandler
'设置 Flags 属性
Form1.CommonDialog1.Flags = cdlCCRGBInit
' 显示“颜色”对话框
Form1.CommonDialog1.ShowColor
' 设置窗体的背景颜色为选定的颜色
If Form8.Option1(0).Value = True Then
TempDengGuanColor1 = Form1.CommonDialog1.Color
Form8.Shape1(0).BackColor = TempDengGuanColor1
Form8.Shape1(0).BorderColor = TempDengGuanColor1
End If
If Form8.Option1(1).Value = True Then
TempDengGuanColor2 = Form1.CommonDialog1.Color
Form8.Shape1(1).BackColor = TempDengGuanColor2
Form8.Shape1(1).BorderColor = TempDengGuanColor2
End If
If Form8.Option1(2).Value = True Then
TempDengGuanColor3 = Form1.CommonDialog1.Color
Form8.Shape1(2).BackColor = TempDengGuanColor3
Form8.Shape1(2).BorderColor = TempDengGuanColor3
End If
If TempDengGuanColor1 <> DengGuanColor1 Then
Form8.Command3.Enabled = True
End If
If TempDengGuanColor2 <> DengGuanColor2 Then
Form8.Command3.Enabled = True
End If
If TempDengGuanColor3 <> DengGuanColor3 Then
Form8.Command3.Enabled = True
End If
Exit Sub
ErrHandler:
' 用户按了“取消”按钮
Exit Sub
End Sub
Private Sub Command2_Click()
TempDengGuanColor1 = QBColor(ColorRed)
TempDengGuanColor2 = QBColor(ColorGreen)
TempDengGuanColor3 = QBColor(ColorBlue)
Form8.Shape1(0).BackColor = TempDengGuanColor1
Form8.Shape1(0).BorderColor = TempDengGuanColor1
Form8.Shape1(1).BackColor = TempDengGuanColor2
Form8.Shape1(1).BorderColor = TempDengGuanColor2
Form8.Shape1(2).BackColor = TempDengGuanColor3
Form8.Shape1(2).BorderColor = TempDengGuanColor3
If TempDengGuanColor1 <> DengGuanColor1 Then
Form8.Command3.Enabled = True
End If
If TempDengGuanColor2 <> DengGuanColor2 Then
Form8.Command3.Enabled = True
End If
If TempDengGuanColor3 <> DengGuanColor3 Then
Form8.Command3.Enabled = True
End If
End Sub
Private Sub Command3_Click()
If TempDengGuanColor1 = TempDengGuanColor2 Then
MsgBox "[灯管颜色1]不能与[灯管颜色2]相同"
GoTo MyEnd
End If
If TempDengGuanColor1 = TempDengGuanColor3 Then
MsgBox "[灯管颜色1]不能与[灯管颜色3]相同"
GoTo MyEnd
End If
If TempDengGuanColor2 = TempDengGuanColor3 Then
MsgBox "[灯管颜色2]不能与[灯管颜色3]相同"
GoTo MyEnd
End If
DengGuanColor1 = TempDengGuanColor1
DengGuanColor2 = TempDengGuanColor2
DengGuanColor3 = TempDengGuanColor3
If Form1.Data5.Recordset.RecordCount <> 0 Then
Form1.Data5.Recordset.MoveFirst
Form1.Data5.Recordset.Edit
Form1.Data5.Recordset.Fields("灯管颜色1") = DengGuanColor1
Form1.Data5.Recordset.Fields("灯管颜色2") = DengGuanColor2
Form1.Data5.Recordset.Fields("灯管颜色3") = DengGuanColor3
Form1.Data5.Recordset.Update
Else
Form1.Data5.Recordset.AddNew
Form1.Data5.Recordset.Fields("灯管颜色1") = DengGuanColor1
Form1.Data5.Recordset.Fields("灯管颜色2") = DengGuanColor2
Form1.Data5.Recordset.Fields("灯管颜色3") = DengGuanColor3
Form1.Data5.Recordset.Update
End If
If NowColor = 0 Then
For i = 0 To NowLs - 1
Form1.Shape1(i).BackColor = DengGuanColor1
Form1.Shape1(i).BorderColor = DengGuanColor1
Next i
ElseIf NowColor = 1 Then
For i = 0 To NowLs - 1 Step 2
Form1.Shape1(i).BackColor = DengGuanColor1
Form1.Shape1(i).BorderColor = DengGuanColor1
Next i
For i = 1 To NowLs - 1 Step 2
Form1.Shape1(i).BackColor = DengGuanColor2
Form1.Shape1(i).BorderColor = DengGuanColor2
Next i
ElseIf NowColor = 2 Then
For i = 0 To NowLs - 1 Step 3
Form1.Shape1(i).BackColor = DengGuanColor1
Form1.Shape1(i).BorderColor = DengGuanColor1
Next i
For i = 1 To NowLs - 1 Step 3
Form1.Shape1(i).BackColor = DengGuanColor2
Form1.Shape1(i).BorderColor = DengGuanColor2
Next i
For i = 2 To NowLs - 1 Step 3
Form1.Shape1(i).BackColor = DengGuanColor3
Form1.Shape1(i).BorderColor = DengGuanColor3
Next i
End If
MyEnd:
Form8.Command3.Enabled = False
End Sub
Private Sub Command4_Click()
Unload Form8
Form1.Enabled = True
Form1.SetFocus
End Sub
Private Sub Form_Load()
Form8.Option1(0).Value = True
TempDengGuanColor1 = DengGuanColor1
TempDengGuanColor2 = DengGuanColor2
TempDengGuanColor3 = DengGuanColor3
Form8.Shape1(0).BackColor = TempDengGuanColor1
Form8.Shape1(0).BorderColor = TempDengGuanColor1
Form8.Shape1(1).BackColor = TempDengGuanColor2
Form8.Shape1(1).BorderColor = TempDengGuanColor2
Form8.Shape1(2).BackColor = TempDengGuanColor3
Form8.Shape1(2).BorderColor = TempDengGuanColor3
Form8.Command3.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -