Imports System
Imports System.Drawing
Public Class Figura
Protected foglio As Disegno
Private coordinate As tratto
Private vecchieCoordinate As Tratto
Private PennaLinea As Pen
Private stato As Boolean
Public Sub New(ByVal posto As Disegno)
foglio = posto
stato = False
PennaLinea = New Pen(Color.Red, 1)
PennaLinea.EndCap = Drawing2D.LineCap.Round
PennaLinea.StartCap = Drawing2D.LineCap.Round
End Sub
Public Function getCoordinate() As Tratto
Return New Tratto(coordinate)
End Function
Public Overridable Sub setCoordinate(ByVal nuove As Tratto)
vecchieCoordinate = New Tratto(coordinate)
coordinate = New Tratto(nuove)
End Sub
Public Overridable Function GetLeVecchieCoordinate() As Tratto
Return New Tratto(vecchieCoordinate)
End Function
Public Overridable Sub disegna()
' non fa nulla
End Sub
Public Overridable Sub disegna(ByVal eliminaPrecedente As Boolean)
' non fa nulla
End Sub
Public Overridable Sub cancella()
' Non fa nulla
End Sub
Public Overridable Property attivo() As Boolean
Get
Return stato
End Get
Set(ByVal value As Boolean)
stato = value
End Set
End Property
Public Overridable Property pennino() As Pen
Get
Return PennaLinea
End Get
Set(ByVal value As Pen)
PennaLinea.Width = value.Width
PennaLinea.Color = value.Color
foglio.pennino = value
End Set
End Property
Public Overridable Function area() As Double
Return 0.0
End Function
Public Overridable Function perimetro() As Double
Return 0.0
End Function
Public Overrides Function ToString() As String
Return "Classe base"
End Function
End Class