'类名clsTextOLE
Option Explicit
Private Type TypeOldText
sText As String
fontS As Long
selStartX As Long
isUsed As Boolean
End Type
Dim saveTxt() As TypeOldText
Dim curSeat As Long
Dim lastSeat As Long 'AddNew修改的最后一个位置
Dim isGetOld As Boolean ' '正在撤销恢复文本
Event BackEmpty()
Public Function ShowLast(myTxtBox As TextBox)
isGetOld = True
myTxtBox.Text = saveTxt(lastSeat).sText
myTxtBox.FontSize = saveTxt(lastSeat).fontS
myTxtBox.SelStart = saveTxt(lastSeat).selStartX
curSeat = lastSeat
End Function
Public Function AddNew(myTxtBox As TextBox)
If isGetOld Then isGetOld = False: Exit Function
curSeat = NextSeat
saveTxt(curSeat).sText = myTxtBox.Text
saveTxt(curSeat).fontS = myTxtBox.FontSize
saveTxt(curSeat).selStartX =