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

📄 ask.frm

📁 一个修改二进制文件的小程序,不过在打开大于1M的文件时耗时较长
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form2 
   BorderStyle     =   1  'Fixed Single
   ClientHeight    =   1125
   ClientLeft      =   4410
   ClientTop       =   4275
   ClientWidth     =   3630
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   1125
   ScaleWidth      =   3630
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton cmdno 
      Cancel          =   -1  'True
      Caption         =   "取消"
      Height          =   300
      Left            =   2880
      TabIndex        =   5
      Top             =   360
      Width           =   735
   End
   Begin VB.CommandButton cmdyes 
      Caption         =   "确定"
      Default         =   -1  'True
      Height          =   300
      Left            =   2880
      TabIndex        =   4
      Top             =   0
      Width           =   735
   End
   Begin VB.TextBox Text1 
      Height          =   375
      HideSelection   =   0   'False
      Left            =   0
      TabIndex        =   0
      Top             =   720
      Width           =   3615
   End
   Begin VB.Frame Frame1 
      Caption         =   "进制"
      Height          =   615
      Left            =   0
      TabIndex        =   1
      Top             =   0
      Width           =   2775
      Begin VB.OptionButton opt 
         Caption         =   "十进制"
         Height          =   255
         Index           =   1
         Left            =   1560
         TabIndex        =   3
         Top             =   240
         Width           =   855
      End
      Begin VB.OptionButton opt 
         Caption         =   "十六进制"
         Height          =   255
         Index           =   0
         Left            =   240
         TabIndex        =   2
         Top             =   240
         Value           =   -1  'True
         Width           =   1095
      End
   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 Sub cmdno_Click()
'Text1 = MyStr
opt(1).Value = IsNum
Text1.SetFocus
Me.Hide
al = False
End Sub

Private Sub cmdyes_Click()
Dim i As Byte
Dim b As String
b = Text1
If opt(1) Then
Else
    For i = 3 To Len(b) Step 3
        If Mid$(b, i, 1) <> " " Then MsgBox "格式不匹配", vbCritical: Exit Sub
        If Mid$(b, i - 1, 1) = " " Or Mid$(b, i - 2, 1) = " " Then MsgBox "格式不匹配", vbCritical: Exit Sub
    Next i
    For i = (Len(b) \ 3) * 3 + 1 To Len(b)
        If Mid$(b, i, 1) = " " Then MsgBox "格式不匹配", vbCritical: Exit Sub
    Next i
    If Len(b) Mod 3 = 2 Then
        Text1 = Text1 & " "
        b = b & " "
    End If
End If
MyStr = b: IsNum = opt(1).Value
Text1.SetFocus
Me.Hide
al = True
End Sub

Private Sub Form_Load()
Me.Icon = Form1.Icon
If Len(Text1) = 0 Then cmdyes.Enabled = False
End Sub

Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
If Cancel = 0 Then al = False
End Sub

Private Sub opt_Click(Index As Integer)
Text1 = ""
Text1.SetFocus
End Sub

Private Sub Text1_Change()
cmdyes.Enabled = False
If opt(1).Value Then
    If IsNumeric(Text1) Then
        If Val(Text1) >= 0 And InStr(Text1, ".") = 0 And Val(Text1) <= 2147483647 Then
            cmdyes.Enabled = True
        End If
    End If
Else
    If Len(Text1) <> 0 And Len(Text1) Mod 3 <> 1 Then
        cmdyes.Enabled = True
    End If
End If
End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
Dim a As String
a = Chr$(KeyAscii)
If KeyAscii = 8 Or KeyAscii = 32 Then Exit Sub
If opt(1).Value Then
    If a Like "#" Then Exit Sub
Else
    If a Like "[a-f]" Or a Like "[A-F]" Or a Like "#" Then
            If a Like "[a-f]" Then KeyAscii = KeyAscii - 32
            Exit Sub
    End If
End If
KeyAscii = 0
End Sub

⌨️ 快捷键说明

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