Open App.Path & "\1.txt" For Input As #1 Do While Not EOF(1) Line Input #1, s Print s Loop Close #1 For i = 0 To 59 If Mid(s, i + 1, 1) = "0" Then Label1(i).BackColor = vbWhite Else Label1(i).BackColor = vbRed End If Next i End Sub
Private Sub Form_Unload(Cancel As Integer) Dim s As String s = "" For i = 0 To 59 If Label1(i).BackColor = vbWhite Then s = s & "0" Else s = s & "1" End If Next i Open App.Path & "\1.txt" For Output As #1 Print #1, s Close #1 End Sub
'测试OK,点一次变红。再点一次恢复。重新打开恢复上次的样式 小噤 QQ 574221329 Private Sub Form_Load() For i = 0 To Me.Label18.Count - 1 Label18(i).ForeColor = GetSetting("VB贴吧", "控件点击保存", i, vbBlack) Next End Sub
Private Sub Label18_Click(Index As Integer) SaveSetting "VB贴吧", "控件点击保存", Index, vbRed - Label18(Index).ForeColor Label18(Index).ForeColor = GetSetting("VB贴吧", "控件点击保存", Index, vbBlack) End Sub