高分求解,关于写字板中“撤消”的制作方法

zhx1983 2003-05-06 02:59:20
要编制一个类似写字板的小程序,关于撤消按钮的制作方法

怎样实现多次撤消,什么样的算法思路,请教
...全文
5 点赞 收藏 2
写回复
2 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
rainstormmaster 2003-05-06
也可以用数组。
回复
handsomge 2003-05-06
Option Explicit

Dim cUndoData As New Collection
Dim cRedoData As New Collection
Public bCauseValidate As Boolean
Private Sub SaveUndoData()
cUndoData.Add Text1.Text
Dim i
If cRedoData.Count > 0 Then
For i = 0 To cRedoData.Count - 1
cRedoData.Remove (i)
Next
End If
End Sub
Private Sub Undo()
cRedoData.Add cUndoData.Item(cUndoData.Count - 1)
bCauseValidate = False
Text1.Text = cUndoData.Item(cUndoData.Count - 1)
bCauseValidate = True
cUndoData.Remove (cUndoData.Count - 1)
End Sub

Private Sub Command1_Click()
If CanUndo Then Undo
End Sub

Private Sub Form_Load()
bCauseValidate = True
SaveUndoData
End Sub

Private Sub Text1_Change()
If bCauseValidate Then
SaveUndoData
End If
End Sub
Private Function CanUndo() As Boolean
CanUndo = IIf(cUndoData.Count > 1, True, False)
End Function
回复
相关推荐
发帖
VB基础类
创建于2007-09-28

7489

社区成员

VB 基础类
申请成为版主
帖子事件
创建了帖子
2003-05-06 02:59
社区公告
暂无公告