<Serializable()> Public Class BitmapObject
    Inherits GraphicBase
    Dim _img As Image

    Public WriteOnly Property Image() As Image
        Set(ByVal Value As Image)
            If Not IsNothing(_img) Then
                _img.Dispose()
            End If
            _img = Value
        End Set
    End Property

    Public Overrides Sub Draw(ByVal g As System.Drawing.Graphics, ByVal isPreview As Boolean)
        Dim rc As RectangleF = GetRectangleF()
        If isPreview Then
            ' プレビュー時
            g.DrawRectangle(PreviewPen, rc.X, rc.Y, rc.Width, rc.Height)
        Else
            ' 非プレビュー時
            If Not IsNothing(_img) Then
                g.DrawImage(_img, rc)
            End If
        End If

    End Sub

    Public Overrides Sub Dispose()
        If Not IsNothing(_img) Then
            _img.Dispose()
        End If
        MyBase.Dispose()
    End Sub
End Class
