cline.vb

来自「苏金明编写的《用VB.NET和VC#.NET开发交互式CAD系统》一书的源代码」· VB 代码 · 共 67 行

VB
67
字号
Public Class CLine
    Private m_ID, m_Width As Integer
    Private m_Color As Color
    Private m_Begin, m_End As PointF

    Public Property ID() As Integer
        Get
            Return m_ID
        End Get
        Set(ByVal Value As Integer)
            m_ID = Value
        End Set
    End Property

    Public Property Color() As Color
        Get
            Return m_Color
        End Get
        Set(ByVal Value As Color)
            m_Color = Value
        End Set
    End Property

    Public Property Width() As Integer
        Get
            Return m_Width
        End Get
        Set(ByVal Value As Integer)
            m_Width = Value
        End Set
    End Property

    Public Property LBegin() As PointF
        Get
            Return m_Begin
        End Get
        Set(ByVal Value As PointF)
            m_Begin = Value
        End Set
    End Property

    Public Property LEnd() As PointF
        Get
            Return m_End
        End Get
        Set(ByVal Value As PointF)
            m_End = Value
        End Set
    End Property

    Public Sub New()
    End Sub

    Public Sub New(ByVal aID As Integer, ByVal aColor As Color, _
            ByVal aWidth As Integer, ByVal p1 As PointF, ByVal p2 As PointF)
        m_ID = aID
        m_Color = aColor
        m_Width = aWidth
        m_Begin = p1
        m_End = p2
    End Sub

    Public Sub Draw(ByVal g As Graphics)
        g.DrawLine(New Pen(m_Color, m_Width), m_Begin, m_End)
    End Sub
End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?