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

📄 form1.frm

📁 根据给定的IP地址和子网掩码中1的位数
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Height          =   375
      Left            =   240
      TabIndex        =   18
      Top             =   2520
      Width           =   1575
   End
   Begin VB.Label Label8 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3480
      TabIndex        =   17
      Top             =   1920
      Width           =   255
   End
   Begin VB.Label Label7 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2280
      TabIndex        =   16
      Top             =   1920
      Width           =   255
   End
   Begin VB.Label Label6 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   15
      Top             =   1920
      Width           =   255
   End
   Begin VB.Label Label5 
      Caption         =   "所对应的二进制为:"
      Height          =   375
      Left            =   240
      TabIndex        =   10
      Top             =   1440
      Width           =   1695
   End
   Begin VB.Label Label4 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   3480
      TabIndex        =   7
      Top             =   840
      Width           =   255
   End
   Begin VB.Label Label3 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   2280
      TabIndex        =   6
      Top             =   840
      Width           =   255
   End
   Begin VB.Label label1 
      Caption         =   "请输入一个IP地址:"
      Height          =   255
      Left            =   240
      TabIndex        =   1
      Top             =   360
      Width           =   1695
   End
   Begin VB.Label Label2 
      Caption         =   "."
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   18
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   495
      Left            =   1080
      TabIndex        =   0
      Top             =   840
      Width           =   255
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Text1.SetFocus
Text3.SetFocus
Text5.SetFocus
Text7.SetFocus
End Sub

Private Sub Command2_Click()
d = Val(Text1.Text) '输入要转化的数字
Do While (d)
c = d Mod 2
d = d \ 2
er1 = c & er1
Loop
Text2.Text = er1 '输出结果

a = Val(Text3.Text) '输入要转化的数字
Do While (a)
b = a Mod 2
a = a \ 2
er2 = b & er2
Loop
If Len(er2) = 1 Then
Text4.Text = "0000000" + er2 '输出结果
End If
If Len(er2) = 2 Then
Text4.Text = "000000" + er2
End If
If Len(er2) = 3 Then
Text4.Text = "00000" + er2
End If
If Len(er2) = 4 Then
Text4.Text = "0000" + er2
End If
If Len(er2) = 5 Then
Text4.Text = "000" + er2
End If
If Len(er2) = 6 Then
Text4.Text = "00" + er2
End If
If Len(er2) = 7 Then
Text4.Text = "0" + er2
End If
If Len(er2) = 8 Then
Text4.Text = er2
End If

m = Val(Text5.Text) '输入要转化的数字
Do While (m)
n = m Mod 2
m = m \ 2
er3 = n & er3
Loop
If Len(er3) = 1 Then
Text6.Text = "0000000" + er3 '输出结果
End If
If Len(er3) = 2 Then
Text6.Text = "000000" + er3
End If
If Len(er3) = 3 Then
Text6.Text = "00000" + er3
End If
If Len(er3) = 4 Then
Text6.Text = "0000" + er3
End If
If Len(er3) = 5 Then
Text6.Text = "000" + er3
End If
If Len(er3) = 6 Then
Text6.Text = "00" + er3
End If
If Len(er3) = 7 Then
Text6.Text = "0" + er3
End If
If Len(er3) = 8 Then
Text6.Text = er3
End If

x = Val(Text7.Text) '输入要转化的数字
Do While (x)
y = x Mod 2
x = x \ 2
er4 = y & er4
Loop
If Len(er4) = 1 Then
Text8.Text = "0000000" + er4 '输出结果
End If
If Len(er4) = 2 Then
Text8.Text = "000000" + er4
End If
If Len(er4) = 3 Then
Text8.Text = "00000" + er4
End If
If Len(er4) = 4 Then
Text8.Text = "0000" + er4
End If
If Len(er4) = 5 Then
Text8.Text = "000" + er4
End If
If Len(er4) = 6 Then
Text8.Text = "00" + er4
End If
If Len(er4) = 7 Then
Text8.Text = "0" + er4
End If
If Len(er4) = 8 Then
Text8.Text = er4
End If

End Sub

Private Sub Command3_Click()
Text9.SetFocus
Text10.SetFocus
Text11.SetFocus
Text12.SetFocus
End Sub

Private Sub Command4_Click()
 
Text13.Text = Text2.Text
Text14.Text = Text4.Text
Text15.Text = Text6.Text
j = InStr(Text12.Text, 0)
l = j - 1
k = Left(Text8.Text, l)
If Len(l) = 1 Then
Text16.Text = k + "1111111"
End If
If Len(l) = 2 Then
Text16.Text = k + "111111"
End If
If Len(l) = 3 Then
Text16.Text = k + "11111"
End If
If Len(l) = 4 Then
Text16.Text = k + "1111"
End If
If Len(l) = 5 Then
Text16.Text = k + "111"
End If
If Len(l) = 6 Then
Text16.Text = k + "11"
End If
If Len(l) = 7 Then
Text16.Text = k + "1"
End If
If Len(l) = 8 Then
Text16.Text = k
End If
 Text17.Text = 2 ^ l - 2
End Sub

Private Sub Command5_Click()
Form2.Show
End Sub

Private Sub Form_Load()
er1 = ""
er2 = ""
er3 = ""
er4 = ""

End Sub

Private Sub Text17_Change()
Form2.Text1.Text = Form1.Text17.Text
End Sub

⌨️ 快捷键说明

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