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

📄 form1.frm

📁 一个完整的用VB实现的16进制编辑器程序的源代码
💻 FRM
📖 第 1 页 / 共 3 页
字号:
            Top             =   960
            Width           =   375
         End
      End
      Begin VB.CommandButton VTop 
         BackColor       =   &H00C0C0C0&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   7440
         Picture         =   "Form1.frx":326E
         Style           =   1  'Graphical
         TabIndex        =   8
         ToolTipText     =   "Goto top"
         Top             =   720
         Width           =   2055
      End
      Begin VB.CommandButton Up10 
         BackColor       =   &H00C0C0C0&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   7440
         Picture         =   "Form1.frx":3550
         Style           =   1  'Graphical
         TabIndex        =   7
         ToolTipText     =   "Up 10 lines"
         Top             =   1200
         Width           =   2055
      End
      Begin VB.CommandButton Up1 
         BackColor       =   &H00C0C0C0&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   7440
         Picture         =   "Form1.frx":37C2
         Style           =   1  'Graphical
         TabIndex        =   6
         ToolTipText     =   "Up 1 line"
         Top             =   1680
         Width           =   2055
      End
      Begin VB.CommandButton Down1 
         BackColor       =   &H00C0C0C0&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   495
         Left            =   7440
         Picture         =   "Form1.frx":3A34
         Style           =   1  'Graphical
         TabIndex        =   5
         ToolTipText     =   "Down 1 line"
         Top             =   2280
         Width           =   2055
      End
      Begin VB.CommandButton Down10 
         BackColor       =   &H00C0C0C0&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   7440
         Picture         =   "Form1.frx":3CA6
         Style           =   1  'Graphical
         TabIndex        =   4
         ToolTipText     =   "Down 10 lines"
         Top             =   2880
         Width           =   2055
      End
      Begin VB.CommandButton Bottom 
         BackColor       =   &H00C0C0C0&
         Enabled         =   0   'False
         BeginProperty Font 
            Name            =   "MS Sans Serif"
            Size            =   8.25
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   7440
         Picture         =   "Form1.frx":3F18
         Style           =   1  'Graphical
         TabIndex        =   3
         ToolTipText     =   "Goto bottom"
         Top             =   3360
         Width           =   2055
      End
      Begin VB.PictureBox Position 
         Appearance      =   0  'Flat
         AutoRedraw      =   -1  'True
         BackColor       =   &H00C0C0C0&
         BeginProperty Font 
            Name            =   "Courier"
            Size            =   15
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   3060
         Left            =   120
         ScaleHeight     =   3030
         ScaleWidth      =   1785
         TabIndex        =   2
         Top             =   720
         Width           =   1815
      End
      Begin VB.PictureBox ColSet 
         Appearance      =   0  'Flat
         AutoRedraw      =   -1  'True
         BackColor       =   &H00C0C0C0&
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   15.75
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   2040
         ScaleHeight     =   345
         ScaleWidth      =   5265
         TabIndex        =   1
         Top             =   240
         Width           =   5295
      End
      Begin VB.Label ByteNo 
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   700
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   120
         TabIndex        =   13
         Top             =   240
         Width           =   1815
      End
      Begin VB.Label Size 
         Appearance      =   0  'Flat
         BackColor       =   &H00C0C0C0&
         BorderStyle     =   1  'Fixed Single
         BeginProperty Font 
            Name            =   "Times New Roman"
            Size            =   12
            Charset         =   0
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H80000008&
         Height          =   375
         Left            =   7440
         TabIndex        =   11
         Top             =   240
         Width           =   2055
      End
   End
   Begin VB.Menu filemnu 
      Caption         =   "&File"
      Begin VB.Menu openmnu 
         Caption         =   "&Open"
         Shortcut        =   ^O
      End
      Begin VB.Menu savemnu 
         Caption         =   "&Save"
         Shortcut        =   ^S
      End
      Begin VB.Menu closemnu 
         Caption         =   "C&lose"
         Shortcut        =   ^L
      End
      Begin VB.Menu a 
         Caption         =   "-"
      End
      Begin VB.Menu exitmnu 
         Caption         =   "E&xit"
         Shortcut        =   ^Q
      End
   End
   Begin VB.Menu editmnu 
      Caption         =   "&Edit"
      Begin VB.Menu editmodemnu 
         Caption         =   "E&dit Mode"
         Checked         =   -1  'True
         Shortcut        =   ^D
      End
      Begin VB.Menu b 
         Caption         =   "-"
      End
      Begin VB.Menu searchmnu 
         Caption         =   "S&earch"
         Shortcut        =   ^E
      End
      Begin VB.Menu bytemnu 
         Caption         =   "&Goto byte"
         Shortcut        =   ^G
      End
   End
   Begin VB.Menu tools 
      Caption         =   "&Tools"
      Begin VB.Menu insertbytes 
         Caption         =   "&Insert Byte"
         Shortcut        =   ^I
      End
      Begin VB.Menu rembyte 
         Caption         =   "&Remove Byte"
         Shortcut        =   ^R
      End
      Begin VB.Menu addbyte 
         Caption         =   "&Add Bytes"
         Shortcut        =   ^A
      End
   End
   Begin VB.Menu popup 
      Caption         =   "popup"
      Visible         =   0   'False
      Begin VB.Menu edmode 
         Caption         =   "E&dit Mode"
         Checked         =   -1  'True
      End
      Begin VB.Menu c 
         Caption         =   "-"
      End
      Begin VB.Menu insertb 
         Caption         =   "&Insert Byte"
      End
      Begin VB.Menu removeb 
         Caption         =   "&Remove Byte"
      End
      Begin VB.Menu addb 
         Caption         =   "&Add Bytes"
      End
      Begin VB.Menu e 
         Caption         =   "-"
      End
      Begin VB.Menu gos 
         Caption         =   "S&earch"
      End
      Begin VB.Menu gob 
         Caption         =   "&Goto byte"
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim SetMode As Boolean

Private Sub addb_Click()
AddBytes_Click
End Sub

Private Sub addbyte_Click()
AddBytes_Click
End Sub

Private Sub AddBytes_Click()
On Error Resume Next
If MsgBox("Are you sure you want to add bytes to the end of the file?", vbYesNo) = vbNo Then Exit Sub
Form4.Show
End Sub

Private Sub asciidisp_KeyUp(KeyCode As Integer, Shift As Integer)
On Error Resume Next
If asciidisp > 255 Then
    hexdisp.Text = ""
    chardisp.Text = ""
    binarytxt.Text = ""
Else
    hexdisp.Text = Hex(asciidisp.Text)
    chardisp.Text = Chr(asciidisp)
    binarytxt.Text = GetBinary(hexdisp.Text)
End If
End Sub

Private Sub binarytxt_KeyPress(KeyAscii As Integer)
If Chr(KeyAscii) <> vbBack Then
    If (KeyAscii >= 48 And KeyAscii <= 49) Then
        DoEvents
    Else
        KeyAscii = 0
    End If
End If
End Sub

Private Sub binarytxt_KeyUp(KeyCode As Integer, Shift As Integer)
Dim Length As Integer, Counter As Integer, Total As Integer, no As Integer

Length = Len(binarytxt.Text)
no = 1
Total = 0
For Counter = 0 To Length - 1
If Mid(binarytxt.Text, Length - Counter, 1) = 1 Then Total = Total + no
no = no * 2
Next Counter
asciidisp.Text = Total
chardisp.Text = Chr(Total)
hexdisp.Text = Hex(Total)
End Sub

Private Sub Bottom_Click()
Dim EndBit As Integer, SetLen As String
ByteNo.Caption = ""
SetLen = SizeOfFile
Edit.Visible = False
Showtxt.Visible = False
EndBit = Mid(SetLen, Len(SetLen), 1)
CurrentPos = SizeOfFile - EndBit
SortHex
End Sub

Private Sub bytemnu_Click()
If Fileopen = False Then Exit Sub
Form2.Show
End Sub

Private Sub chardisp_KeyUp(KeyCode As Integer, Shift As Integer)
On Error Resume Next
asciidisp.Text = Asc(chardisp.Text)
hexdisp.Text = Hex(asciidisp.Text)
binarytxt.Text = GetBinary(hexdisp.Text)
End Sub

Private Sub closemnu_Click()
Dim Counter As Integer
If Fileopen = False Then Exit Sub

If MsgBox("Are you sure you want to close this file?", vbYesNo) = vbYes Then
ReDim ByteArray(0) As Byte

For Counter = 1 To 100
    HexDisplayed(Counter) = 100
Next Counter

Attributes (False)
Me.Caption = "Hex Editor Pro"
FileName = ""
sizeofile = 0
CurrentPos = 0
DispTxt.Cls
HexDisplay.Cls
ByteNo.Caption = ""
Size.Caption = ""
End If
End Sub

Private Sub CmdInsert_Click()
On Error Resume Next
If Edit.Visible = False Then MsgBox "You must select a byte first", vbExclamation: Exit Sub
If ByteNo.Caption = "" Then Exit Sub
If MsgBox("Are you sure you want to add a byte here?", vbYesNo) = vbNo Then Exit Sub
insertbyte (ByteNo.Caption)
Edit.Text = "00"
SortHex
ByteNo = ""
End Sub

Private Sub cmdremove_Click()
On Error Resume Next
If Edit.Visible = False Then MsgBox "You must select a byte first", vbExclamation: Exit Sub
If ByteNo.Caption = "" Then Exit Sub
If MsgBox("Are you sure you want to remove this byte?", vbYesNo) = vbNo Then Exit Sub
RemoveByte (ByteNo.Caption)
Edit.Visible = False
Showtxt.Visible = False
SortHex
ByteNo = ""
End Sub

Private Sub DispTxt_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
On Error Resume Next
Dim Col, Row, no As Integer, HexSet As String, SAlpha As String, SetTemp As Integer

If Button = 2 And Fileopen = True Then
PopupMenu popup, , DispTxt.Left + X + 30, DispTxt.Top + Y + 380
Exit Sub
End If

Edit.Left = Int((X / HexDisplay.Width) * 10) * (HexDisplay.Width / 10)
Edit.Top = Int((Y / HexDisplay.Height) * 10) * (HexDisplay.Height / 10)

Showtxt.Left = Int((X / HexDisplay.Width) * 10) * (HexDisplay.Width / 10)
Showtxt.Top = Int((Y / HexDisplay.Height) * 10) * (HexDisplay.Height / 10)


Col = Int((X / HexDisplay.Width) * 10) + 1
Row = Int((Y / HexDisplay.Height) * 10) + 1

SetRow = Row
SetCol = Col

no = ((Row - 1) * 10) + Col


SetTemp = HexDisplayed(no)
If SetTemp = 0 Or SetTemp = 13 Or SetTemp = 10 Then
    SAlpha = " "
Else
    SAlpha = Chr(SetTemp)
End If

Showtxt.Caption = SAlpha

If Fileopen = True Then
    ByteNo.Caption = CurrentPos + (no - 1)
End If

⌨️ 快捷键说明

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