程序代码:
Option Explicit Dim CheckedFlag As Boolean Private Sub Check1_Click() If Check1.Value = 1 Then CheckedFlag = True Else CheckedFlag = False End If Call FrontShow End Sub Private Sub Form_Load() Form1.Caption = "前端显示" Form1.AutoRedraw = True Debug.Print "Form_Load" End Sub Private Sub FrontShow() If CheckedFlag Then Form1.Cls Print "Option Explicit" & Chr(13) & Chr(13) & _ "Dim CheckedFlag As Boolean" & Chr(13) & Chr(13) & _ "Private Sub Check1_Click()" & Chr(13) & _ " If Check1.Value = 1 Then" & Chr(13) & _ " CheckedFlag = True" & Chr(13) & _ " Else" & Chr(13) & _ " CheckedFlag = False" & Chr(13) & _ " End If" & Chr(13) & _ " Call FrontShow" & Chr(13) & _ "End Sub" & Chr(13) & _ Chr(13) & Chr(13) & _ "Private Sub Form_Load()" & Chr(13) & _ " Form1.Caption =" & Chr(34) & "前端显示" & Chr(34) & Chr(13) & "" & _ " Form1.AutoRedraw = True" & Chr(13) & _ " Debug.Print" & Chr(34) & "Form_Load" & Chr(34) & Chr(13) & _ "End Sub" & Chr(13) & _ Chr(13) & Chr(13) & _ "Private Sub FrontShow()" & Chr(13) & _ " If CheckedFlag Then" & Chr(13) & _ " Print" & Chr(13) & _ " Else" & Chr(13) & _ " Form1.Cls" & Chr(13) & _ " End If" & Chr(13) & _ "End Sub" Else Form1.Cls End If End Sub