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

📄 mm_mil.frm

📁 用于PCB设计中的mm到mil的单位转换。
💻 FRM
字号:
VERSION 5.00
Begin VB.Form mm_mil 
   Caption         =   "PCB尺寸计算器"
   ClientHeight    =   2025
   ClientLeft      =   60
   ClientTop       =   345
   ClientWidth     =   4275
   Icon            =   "mm_mil.frx":0000
   KeyPreview      =   -1  'True
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   2025
   ScaleWidth      =   4275
   StartUpPosition =   2  '屏幕中心
   Begin VB.TextBox Text2 
      Alignment       =   1  'Right Justify
      BeginProperty Font 
         Name            =   "News Gothic MT"
         Size            =   15.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   2280
      TabIndex        =   3
      Top             =   480
      Width           =   1095
   End
   Begin VB.TextBox Text1 
      Alignment       =   1  'Right Justify
      BeginProperty DataFormat 
         Type            =   1
         Format          =   "0.00"
         HaveTrueFalseNull=   0
         FirstDayOfWeek  =   0
         FirstWeekOfYear =   0
         LCID            =   2052
         SubFormatType   =   1
      EndProperty
      BeginProperty Font 
         Name            =   "News Gothic MT"
         Size            =   15.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   540
      Left            =   240
      TabIndex        =   2
      Top             =   480
      Width           =   1095
   End
   Begin VB.Label Label2 
      Alignment       =   2  'Center
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   15.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   600
      TabIndex        =   4
      Top             =   1440
      Width           =   2895
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "mil"
      BeginProperty Font 
         Name            =   "News Gothic MT"
         Size            =   15.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Index           =   1
      Left            =   3480
      TabIndex        =   1
      Top             =   480
      Width           =   480
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "mm="
      BeginProperty Font 
         Name            =   "News Gothic MT"
         Size            =   15.75
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   420
      Index           =   0
      Left            =   1440
      TabIndex        =   0
      Top             =   480
      Width           =   810
   End
End
Attribute VB_Name = "mm_mil"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim temp As Single
Dim IsChange As Boolean
Dim history As String
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Dim NoDot As Boolean
Private Type POINTAPI
        x As Long
        y As Long
End Type
 
Private Declare Function GetCaretPos Lib "user32" (lpPoint As POINTAPI) As Long
Dim lpp As POINTAPI
Private Declare Function SetCaretPos Lib "user32" (ByVal x As Long, ByVal y As Long) As Long





Private Sub Form_KeyPress(KeyAscii As Integer)
    If KeyAscii = 13 Then
        Label2.Caption = Text1.Text + " mm = " + Text2.Text + " mil"
        Text1.Text = ""
        Text2.Text = ""
    End If
End Sub

Private Sub Form_Load()
    IsChange = False
    NoDot = True
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
    'Label2.Caption = Str(lpp.x) + "----" + Str(lpp.y)
    
    'Label2.Caption = KeyAscii
    'If KeyAscii > 95 And KeyAscii < 106 Or (KeyAscii = 110 And NoDot) Then
    '    If KeyAscii = 110 Then NoDot = False
        IsChange = True
    'Else
    '    Text1.Text = Text1.Text + "g"
    'End If
End Sub

Private Sub text1_Change()
    On Error GoTo NoChange1
    If IsChange Then
        IsChange = False
        If Text1.Text <> nil Then
            temp = Text1.Text
            Text2.Text = Int((temp * 10000) / 254 + 0.5)
        Else
            Text2.Text = ""
        End If
        history = Text1.Text
    End If
Exit Sub
NoChange1:
    Text1.Text = history
    'Text1.Text = Text1.Text + Chr(8)
    'PostMessage 0, &H100, vbKeyBack, 0
    'PostMessage 0, &H101, vbKeyBack, 0
End Sub

Private Sub Text2_KeyPress(KeyAscii As Integer)
    IsChange = True
End Sub

Private Sub text2_Change()
    On Error GoTo NoChange2
    If IsChange Then
        IsChange = False
        If Text2.Text <> nil Then
            temp = Text2.Text
            Text1.Text = Int(254 * temp / 100 + 0.5) / 100
        Else
            Text1.Text = ""
        End If
        history = Text1.Text
    End If
Exit Sub
NoChange2:
    Text2.Text = history
End Sub

⌨️ 快捷键说明

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