Attribute VB_Name = "ModCollections"
Option Explicit

Private vItem As Variant
Private UniqueNum&

Public ColUndo As New Collection
Public ColRedo As New Collection
Public Sub DeleteCollections()

    For Each vItem In ColUndo
        ColUndo.Remove 1
    Next

    For Each vItem In ColRedo
        ColRedo.Remove 1
   Next

    UniqueNum = 0

End Sub
Public Sub UpdateUndo()
    UniqueNum = UniqueNum + 1
        MDI.ActiveForm.picImage.Picture = MDI.ActiveForm.picImage.Image
        ColUndo.Add Item:=MDI.ActiveForm.picImage.Picture, Key:=CStr(UniqueNum)
    MDI.tbHorz.Buttons(9).Visible = ColUndo.Count > 1
    'Form1.cmdUndo.Visible = ColUndo.Count > 1
    MDI.tbHorz.Buttons(10).Visible = ColRedo.Count > 0
    'Form1.cmdRedo.Visible = ColRedo.Count > 0
    If Dirty = False Then Exit Sub
    Dirty = True
End Sub
Public Sub DoUnDo()
    ColRedo.Add ColUndo.Item(ColUndo.Count)
    ColUndo.Remove ColUndo.Count
    MDI.ActiveForm.picImage.Picture = ColUndo.Item(ColUndo.Count)
    MDI.ActiveForm.picImage.Refresh
    'With frmImage
        '.PaintDown
     '   .Refresh
   'End With
    MDI.tbHorz.Buttons(9).Visible = ColUndo.Count > 1
    'Form1.cmdUndo.Visible = ColUndo.Count > 1
    MDI.tbHorz.Buttons(10).Visible = ColRedo.Count > 0
    'Form1.cmdRedo.Visible = ColRedo.Count > 0
End Sub
Public Sub DoReDo()
MDI.tbHorz.Buttons(10).Visible = ColRedo.Count > 0
'Form1.cmdRedo.Visible = ColRedo.Count > 0
    ColUndo.Add ColRedo.Item(ColRedo.Count)
    ColRedo.Remove ColRedo.Count
        MDI.ActiveForm.picImage.Picture = ColUndo.Item(ColUndo.Count)
    MDI.ActiveForm.picImage.Refresh
    'With frmImage
        '.PaintDown
     '   .Refresh
    'End With
 MDI.tbHorz.Buttons(10).Visible = ColRedo.Count > 0
    'Form1.cmdRedo.Visible = ColRedo.Count > 0
 MDI.tbHorz.Buttons(9).Visible = ColUndo.Count > 1
    'Form1.cmdUndo.Visible = ColUndo.Count > 1
End Sub
Public Sub ClearRedo()
    For Each vItem In ColRedo
        ColRedo.Remove 1
    Next
End Sub
