Public Class Memento
  Private x As Integer, y As Integer
  Private w As Integer, h As Integer
  Private rect As vbPatterns.Rectangle
  Private visRect As visRectangle

  Public Sub New(ByVal vrect As visRectangle)
    'Przechowaj stan prostokąta
    visRect = vrect
    rect = vrect.rects
    x = rect.x
    y = rect.y
    w = rect.w
    h = rect.h
  End Sub

  Public Sub restore()
    'Odtwórz stan prostokąta
    rect.x = x
    rect.y = y
    rect.h = h
    rect.w = w
    visRect.rects = rect
  End Sub

End Class
