📄 form1.frm
字号:
Left = 2430
TabIndex = 5
Top = 405
Width = 375
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public sum As Integer
Private Sub Command1_Click()
If Text11.Text <> "" And Val(Text11.Text) > 0 Then
If Text10.Text = "" Then
If Val(Text11.Text) <= sum Then
Text10.Text = Text11.Text
Text10.Visible = True
sum = sum - Val(Text11.Text)
Label8.Caption = sum
Else
MsgBox "内存容量不足"
End If
ElseIf Text9.Text = "" Then
If Val(Text11.Text) <= sum Then
Text9.Text = Text11.Text
Text9.Visible = True
sum = sum - Val(Text11.Text)
Label8.Caption = sum
Else
If Val(Text11.Text) <= 2000 Then
Text10.Text = Text11.Text
sum = 2000 - Val(Text11.Text)
Label8.Caption = sum
Else
MsgBox "内存容量不足"
GoTo a:
End If
End If
a:
ElseIf Text8.Text = "" Then
If Val(Text11.Text) <= sum Then
Text8.Text = Text11.Text
Text8.Visible = True
sum = sum - Val(Text11.Text)
Label8.Caption = sum
Else
If Val(Text11.Text) <= 2000 Then
If Val(Text10.Text) + sum >= Val(Text11.Text) Then
sum = sum + Val(Text10.Text) - Val(Text11.Text)
Text10.Text = Text9.Text
Text9.Text = Val(Text11.Text)
Label8.Caption = sum
ElseIf Val(Text10.Text) + Val(Text9.Text) + sum >= Val(Text11.Text) Then
Text10.Text = Val(Text11.Text)
Text9.Visible = False
Text9.Text = ""
sum = 2000 - Val(Text11.Text)
Label8.Caption = sum
Else
MsgBox "内存容量不足"
GoTo b:
End If
End If
End If
b:
ElseIf Text7.Text = "" Then
If Val(Text11.Text) <= sum Then
Text7.Text = Val(Text11.Text)
Text7.Visible = True
sum = sum - Val(Text11.Text)
Label8.Caption = sum
Else
If Text11 <= 2000 Then
If Val(Text10.Text) + sum >= Val(Text11.Text) Then
sum = Val(Text10.Text) + sum - Val(Text11.Text)
Text10.Text = Text9.Text
Text9.Text = Text8.Text
Text8.Text = Text11.Text
Label8.Caption = sum
ElseIf Val(Text10.Text) + Val(Text9.Text) + sum >= Val(Text11.Text) Then
sum = Val(Text10.Text) + Val(Text9.Text) + sum - Val(Text11.Text)
Text10.Text = Text8.Text
Text9.Text = Val(Text11.Text)
Text8.Visible = False
Text8.Text = ""
Label8.Caption = sum
ElseIf Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) + sum >= Val(Text11.Text) Then
Text10.Text = Val(Text11.Text)
Text9.Visible = False
Text8.Visible = False
Text9.Text = ""
Text8.Text = ""
sum = 2000 - Val(Text11.Text)
Label8.Caption = sum
End If
Else
MsgBox "内存容量不足"
GoTo c:
End If
End If
c:
ElseIf Text6.Text = "" Then
If Val(Text11.Text) <= sum Then
sum = sum - Val(Text11.Text)
Text6.Text = Val(Text11.Text)
Text6.Visible = True
Label8.Caption = sum
Else
If Val(Text11.Text) <= 2000 Then
If Val(Text10.Text) + sum >= Val(Text11.Text) Then
sum = Val(Text10.Text) + sum - Val(Text11.Text)
Text10.Text = Text9.Text
Text9.Text = Text8.Text
Text8.Text = Text7.Text
Text7.Text = Val(Text11.Text)
Label8.Caption = sum
ElseIf Val(Text10.Text) + Val(Text9.Text) + sum >= Val(Text11.Text) Then
sum = Val(Text10.Text) + Val(Text9.Text) + sum - Val(Text11.Text)
Text10.Text = Text8.Text
Text9.Text = Text7.Text
Text8.Text = Val(Text11.Text)
Text7.Visible = False
Text7.Text = ""
Label8.Caption = sum
ElseIf Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) + sum >= Val(Text11.Text) Then
sum = Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) + sum - Val(Text11.Text)
Text10.Text = Text7.Text
Text9.Text = Val(Text11.Text)
Text8.Visible = False
Text7.Visible = False
Text8.Text = ""
Text7.Text = ""
Label8.Caption = sum
ElseIf Val(Text11.Text) <= 2000 Then
Text10.Text = Val(Text11.Text)
Text9.Visible = False
Text8.Visible = False
Text7.Visible = False
Text9.Text = ""
Text8.Text = ""
Text7.Text = ""
sum = 2000 - Val(Text11.Text)
Label8.Caption = sum
Else
MsgBox "内存容量不足"
GoTo d:
End If
End If
End If
d:
Else:
If Val(Text11.Text) > sum Then
If Val(Text11.Text) <= 2000 Then
If sum + Val(Text10.Text) >= Val(Text11.Text) Then
sum = sum + Val(Text10.Text) - Val(Text11.Text)
Label8.Caption = sum
Text10.Text = Text9.Text
Text9.Text = Text8.Text
Text8.Text = Text7.Text
Text7.Text = Text6.Text
Text6.Text = Text11.Text
ElseIf sum + Val(Text10.Text) + Val(Text9.Text) >= Text11.Text Then
sum = sum + Val(Text10.Text) + Val(Text9.Text) - Text11.Text
Label8.Caption = sum
Text10.Text = Text8.Text
Text9.Text = Text7.Text
Text8.Text = Text6.Text
Text7.Text = Text11.Text
Text6.Visible = False
Text6.Text = ""
ElseIf sum + Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) >= Text11.Text Then
sum = sum + Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) - Val(Text11.Text)
Label8.Caption = sum
Text10.Text = Text7.Text
Text9.Text = Text6.Text
Text8.Text = Text11.Text
Text6.Visible = False
Text7.Visible = False
Text6.Text = ""
Text7.Text = ""
ElseIf sum + Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) + Val(Text7.Text) >= Text11.Text Then
sum = sum + Val(Text10.Text) + Val(Text9.Text) + Val(Text8.Text) + Val(Text7.Text) - Val(Text11.Text)
Label8.Caption = sum
Text10.Text = Text6.Text
Text9.Text = Text11.Text
Text8.Visible = False
Text6.Visible = False
Text7.Visible = False
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Else
Text6.Visible = False
Text7.Visible = False
Text8.Visible = False
Text9.Visible = False
Text6.Text = ""
Text7.Text = ""
Text8.Text = ""
Text9.Text = ""
Text10.Text = Text11.Text
sum = 2000 - Val(Text11.Text)
Label8.Caption = sum
End If
Else
MsgBox "页面申请失败"
End If
Else
MsgBox "请输入一个比要比sum大而小于2000的内存量,从而满足置换条件:内存满而又要从外在中调入页时!"
End If
End If
Else
MsgBox "请输入新作业需要的内存量"
End If
End Sub
Private Sub Command2_Click()
End
End Sub
Private Sub Form_Activate()
Text11.SetFocus
End Sub
Private Sub Form_Load()
sum = 2000
Label8.Caption = 2000
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -