📄 ss.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 3255
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
Icon = "ss.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
ScaleHeight = 3255
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.Timer Timer2
Interval = 500
Left = 3000
Top = 1440
End
Begin VB.Timer Timer1
Interval = 1
Left = 1800
Top = 1320
End
Begin VB.CommandButton Command2
Caption = "终止"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3840
TabIndex = 7
Top = 2760
Width = 735
End
Begin VB.TextBox Text3
Height = 2175
Left = 50
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 6
Top = 480
Width = 4575
End
Begin VB.CommandButton Command1
Caption = "求解"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 0
TabIndex = 5
Top = 2760
Width = 855
End
Begin VB.TextBox Text2
Height = 375
Left = 1680
TabIndex = 3
Top = 0
Width = 735
End
Begin VB.TextBox Text1
Height = 375
Left = 360
TabIndex = 1
Top = 0
Width = 855
End
Begin VB.Label Label5
Height = 255
Left = 2760
TabIndex = 9
Top = 2880
Width = 855
End
Begin VB.Label Label4
BeginProperty Font
Name = "Times New Roman"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 960
TabIndex = 8
Top = 2880
Width = 1575
End
Begin VB.Label Label3
Caption = "的素数"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 2520
TabIndex = 4
Top = 0
Width = 855
End
Begin VB.Label Label2
Caption = "到"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1320
TabIndex = 2
Top = 0
Width = 375
End
Begin VB.Label Label1
Caption = "从"
BeginProperty Font
Name = "隶书"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 0
TabIndex = 0
Top = 0
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim a As Double
Dim b As Double
Dim c As Double
Dim d As Double
Dim t As Double
Dim bz As Boolean
Private Sub Command1_Click()
Command1.Enabled = False
Text3.Text = ""
If Len(Text1.Text) < 1 Or Len(Text2.Text) < 1 Then
MsgBox "你没有输入数据!", 16, "范围错误!"
Exit Sub
Else
a = Val(Text1.Text)
b = Val(Text2.Text)
If b > 90000 Then
daan = MsgBox("判断大于90000的数将用较长时间" + vbCrLf + " 继续吗?", 36, "询问")
If daan = vbNo Then
Timer1.Enabled = False
Command1.Enabled = True
Command2.Enabled = False
Text2.SetFocus
Text2.SelStart = 0
Text2.SelLength = Len(Text2.Text)
Exit Sub
End If
End If
If a >= b Then
t = a
a = b
b = t
'MsgBox "第一个数应比第二个数小!", 16, "数据错误"
'Exit Sub
End If
If a <= 2 Then
Text3.Text = "2"
a = 2
End If
For c = a To b
bz = False
If c / 2 = c \ 2 Then
bz = True
End If
For d = 3 To Int(Sqr(c)) Step 2
If c / d = c \ d Then
bz = True
d = c
End If
DoEvents
Next d
If bz = False Then
Text3.Text = Text3.Text & " " & Str(c)
End If
Next c
End If
End Sub
Private Sub Command2_Click()
ans = MsgBox("真的要终止运算吗?", 36, "询问")
If ans = vbYes Then
c = b + 1
MsgBox "运算被用户终止", 48, "运算被用户终止"
End If
End Sub
Private Sub Form_Load()
xq = Weekday(Date)
Select Case xq
Case 1
xing = "星期日"
Case 2
xing = "星期一"
Case 3
xing = "星期二"
Case 4
xing = "星期三"
Case 5
xing = "星期四"
Case 6
xing = "星期五"
Case 7
xing = "星期六"
End Select
Me.Top = (Screen.Height - Me.Height) / 2
Me.Left = (Screen.Width - Me.Width) / 2
Label4.Caption = "20" & Date & " " & Time
Label5.Caption = xing
End Sub
Private Sub Form_Resize()
If Me.Height <> 3600 Then
Me.Height = 3600
End If
If Me.Width <> 4800 Then
Me.Width = 4800
End If
End Sub
Private Sub Text3_Click()
Text3.SelStart = 0
Text3.SelLength = Len(Text3.Text)
Clipboard.SetText Text3.SelText
End Sub
Private Sub Timer1_Timer()
Command1.Enabled = Not Command2.Enabled
If c < b Then
Command2.Enabled = True
Else
Command2.Enabled = False
End If
End Sub
Private Sub Timer2_Timer()
Label4.Caption = "20" & Date & " " & Time
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -