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

📄 main.frm

📁 一个比较好玩的电阻器解码和计算需要的颜色色值和温度容限.
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BackColor       =   &H8000000A&
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   "电阻阻值计算器 1.0"
   ClientHeight    =   3195
   ClientLeft      =   45
   ClientTop       =   210
   ClientWidth     =   6360
   Icon            =   "Main.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3195
   ScaleWidth      =   6360
   ShowInTaskbar   =   0   'False
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton Command1 
      Caption         =   "退出"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   4950
      TabIndex        =   10
      Top             =   2910
      Width           =   1380
   End
   Begin VB.Timer Timer3 
      Enabled         =   0   'False
      Interval        =   100
      Left            =   1035
      Top             =   75
   End
   Begin VB.Timer Timer2 
      Enabled         =   0   'False
      Interval        =   100
      Left            =   525
      Top             =   60
   End
   Begin VB.Timer Timer1 
      Enabled         =   0   'False
      Interval        =   100
      Left            =   45
      Top             =   45
   End
   Begin VB.ComboBox ColorBox 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Index           =   3
      Left            =   690
      Style           =   2  'Dropdown List
      TabIndex        =   7
      Top             =   2475
      Width           =   1335
   End
   Begin VB.ComboBox ColorBox 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Index           =   2
      Left            =   690
      Style           =   2  'Dropdown List
      TabIndex        =   6
      Top             =   1995
      Width           =   1875
   End
   Begin VB.ComboBox ColorBox 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Index           =   1
      Left            =   690
      Style           =   2  'Dropdown List
      TabIndex        =   5
      Top             =   1515
      Width           =   1335
   End
   Begin VB.ComboBox ColorBox 
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   315
      Index           =   0
      ItemData        =   "Main.frx":0442
      Left            =   690
      List            =   "Main.frx":0444
      Style           =   2  'Dropdown List
      TabIndex        =   4
      Top             =   1035
      Width           =   1335
   End
   Begin VB.Label Label3 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      Caption         =   "色值 3 = 倍数  色值 4 = 容限"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   900
      TabIndex        =   9
      Top             =   2925
      Width           =   4320
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BackStyle       =   0  'Transparent
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   210
      Left            =   1365
      TabIndex        =   8
      Top             =   60
      Width           =   3690
   End
   Begin VB.Line Line9 
      X1              =   3780
      X2              =   3780
      Y1              =   915
      Y2              =   2595
   End
   Begin VB.Line Line7 
      X1              =   2100
      X2              =   3780
      Y1              =   2595
      Y2              =   2595
   End
   Begin VB.Line Line6 
      X1              =   2640
      X2              =   3075
      Y1              =   2115
      Y2              =   2115
   End
   Begin VB.Line Line5 
      X1              =   3060
      X2              =   3060
      Y1              =   915
      Y2              =   2115
   End
   Begin VB.Line Line4 
      X1              =   2100
      X2              =   2700
      Y1              =   1635
      Y2              =   1635
   End
   Begin VB.Line Line3 
      X1              =   2700
      X2              =   2700
      Y1              =   915
      Y2              =   1635
   End
   Begin VB.Line Line2 
      X1              =   2340
      X2              =   2340
      Y1              =   1155
      Y2              =   915
   End
   Begin VB.Line Line1 
      X1              =   2100
      X2              =   2340
      Y1              =   1155
      Y2              =   1155
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "色值 4"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   3
      Left            =   45
      TabIndex        =   3
      Top             =   2520
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "色值 3"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   2
      Left            =   45
      TabIndex        =   2
      Top             =   2040
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "色值 2"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   1
      Left            =   45
      TabIndex        =   1
      Top             =   1560
      Width           =   540
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      BackStyle       =   0  'Transparent
      Caption         =   "色值 1"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   195
      Index           =   0
      Left            =   45
      TabIndex        =   0
      Top             =   1080
      Width           =   540
   End
   Begin VB.Shape Shape2 
      BackColor       =   &H00808080&
      BackStyle       =   1  'Opaque
      Height          =   135
      Index           =   1
      Left            =   540
      Top             =   555
      Width           =   1455
   End
   Begin VB.Shape Shape2 
      BackColor       =   &H00808080&
      BackStyle       =   1  'Opaque
      Height          =   135
      Index           =   0
      Left            =   4380
      Top             =   555
      Width           =   1455
   End
   Begin VB.Shape Color 
      BackColor       =   &H000000FF&
      BackStyle       =   1  'Opaque
      BorderColor     =   &H00000000&
      FillColor       =   &H00FFFFFF&
      Height          =   615
      Index           =   3
      Left            =   3660
      Top             =   315
      Width           =   255
   End
   Begin VB.Shape Color 
      BackColor       =   &H000000FF&
      BackStyle       =   1  'Opaque
      BorderColor     =   &H00000000&
      FillColor       =   &H00FFFFFF&
      Height          =   615
      Index           =   2
      Left            =   2940
      Top             =   315
      Width           =   255
   End
   Begin VB.Shape Color 
      BackColor       =   &H000000FF&
      BackStyle       =   1  'Opaque
      BorderColor     =   &H00000000&
      FillColor       =   &H00FFFFFF&
      Height          =   615
      Index           =   1
      Left            =   2580
      Top             =   315
      Width           =   255
   End
   Begin VB.Shape Color 
      BackColor       =   &H000000FF&
      BackStyle       =   1  'Opaque
      BorderColor     =   &H00000000&
      FillColor       =   &H00FFFFFF&
      Height          =   615
      Index           =   0
      Left            =   2220
      Top             =   315
      Width           =   255
   End
   Begin VB.Shape Shape1 
      BackColor       =   &H0080C0FF&
      BackStyle       =   1  'Opaque
      Height          =   615
      Left            =   1980
      Shape           =   4  'Rounded Rectangle
      Top             =   315
      Width           =   2415
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Private Const BS_FLAT = &H8000&
Private Const GWL_STYLE = (-16)
Private Const WS_CHILD = &H40000000

Private Type POINTAPI
        x As Long
        y As Long
End Type

Dim L, Char, I As Long
Dim Stars As Boolean
Dim Str, InputStr As String
Dim Was As Integer
Public OneMoreBeerOnTheWall

Private Sub ColorBox_Click(Index As Integer)
If Index = 0 Or Index = 1 Then
If ColorBox(Index).ListIndex = 0 Then Color(Index).BackColor = vbBlack
If ColorBox(Index).ListIndex = 1 Then Color(Index).BackColor = RGB(128, 64, 64)
If ColorBox(Index).ListIndex = 2 Then Color(Index).BackColor = vbRed
If ColorBox(Index).ListIndex = 3 Then Color(Index).BackColor = RGB(255, 123, 36)
If ColorBox(Index).ListIndex = 4 Then Color(Index).BackColor = vbYellow
If ColorBox(Index).ListIndex = 5 Then Color(Index).BackColor = vbGreen
If ColorBox(Index).ListIndex = 6 Then Color(Index).BackColor = vbBlue
If ColorBox(Index).ListIndex = 7 Then Color(Index).BackColor = RGB(128, 0, 128)
If ColorBox(Index).ListIndex = 8 Then Color(Index).BackColor = RGB(129, 129, 129)
If ColorBox(Index).ListIndex = 9 Then Color(Index).BackColor = vbWhite
Command4_Click
Exit Sub
End If
If Index = 2 Then
If ColorBox(Index).ListIndex = 0 Then Color(Index).BackColor = vbBlack
If ColorBox(Index).ListIndex = 1 Then Color(Index).BackColor = RGB(128, 64, 64)
If ColorBox(Index).ListIndex = 2 Then Color(Index).BackColor = vbRed
If ColorBox(Index).ListIndex = 3 Then Color(Index).BackColor = RGB(255, 123, 36)
If ColorBox(Index).ListIndex = 4 Then Color(Index).BackColor = vbYellow
If ColorBox(Index).ListIndex = 5 Then Color(Index).BackColor = vbGreen
If ColorBox(Index).ListIndex = 6 Then Color(Index).BackColor = vbBlue
If ColorBox(Index).ListIndex = 7 Then Color(Index).BackColor = RGB(226, 196, 133)
If ColorBox(Index).ListIndex = 8 Then Color(Index).BackColor = RGB(230, 230, 230)
Command4_Click
Exit Sub
End If
If Index = 3 Then
Color(Index).FillStyle = 1
If ColorBox(Index).ListIndex = 0 Then Color(Index).BackColor = RGB(128, 64, 64)
If ColorBox(Index).ListIndex = 1 Then Color(Index).BackColor = vbRed
If ColorBox(Index).ListIndex = 2 Then Color(Index).BackColor = RGB(226, 196, 133)
If ColorBox(Index).ListIndex = 3 Then Color(Index).BackColor = RGB(230, 230, 230)
If ColorBox(Index).ListIndex = 4 Then Color(Index).FillStyle = 5: Color(Index).BackColor = Shape1.BackColor
Command4_Click
Exit Sub
End If
End Sub

Private Sub Command4_Click()
For I = 0 To 3
If ColorBox(I).ListIndex = -1 Then
ColorBox(I).SetFocus
Exit Sub
End If
Next I
Dim Ring1, Ring2, Ring3, Ring4, Berekening, Tolerantie, Waarde, Deler
Ring1 = ColorBox(0).ListIndex
Ring2 = ColorBox(1).ListIndex

If ColorBox(3).ListIndex = 0 Then Tolerantie = "

⌨️ 快捷键说明

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