VERSION 1.0 CLASS
BEGIN
  MultiUse = -1  'True
  Persistable = 0  'NotPersistable
  DataBindingBehavior = 0  'vbNone
  DataSourceBehavior  = 0  'vbNone
  MTSTransactionMode  = 0  'NotAnMTSObject
END
Attribute VB_Name = "BlueCommand"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
Option Explicit

Implements Command
'Klasa BlueCommand
Private drawList As Collection
Private x As Integer, y As Integer, dx As Integer, dy As Integer
Private pic As PictureBox

Public Sub init(pict As PictureBox)
  Set pic = pict
  Set drawList = New Collection
  x = pic.Width
  dx = -200
  y = 0
  dy = 0
End Sub

Private Sub Command_Execute()
  Dim dl As DrawData
  Set dl = New DrawData
  dl.init x, y, dx, dy
  drawList.add dl
  x = x + dx
  y = y + dy
  pic.Refresh
End Sub

Private Function Command_isUndo() As Boolean
  Command_isUndo = False
End Function

Private Sub Command_Undo()
  Dim Index As Integer
  Dim dl As DrawData
  Index = drawList.Count
  If Index > 0 Then
    Set dl = drawList(Index)
    drawList.Remove Index
    x = dl.getX
    y = dl.getY
  End If
  pic.Refresh
End Sub

Public Sub draw()
  Dim h As Integer, w As Integer
  Dim i As Integer
  Dim dl As DrawData
  h = pic.Height
  w = pic.Width

  For i = 1 To drawList.Count
    Set dl = drawList(i)
    pic.Line (dl.getX, dl.getY)-(dl.getX + dx, dl.getY + h), vbBlue
  Next i
End Sub
