ccircle.vb

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

VB
45
字号
Public Class CCircle
    Private m_Center, m_PCircle As PointF

    '圆心属性
    Public Property Center() As PointF
        Get
            Return m_Center
        End Get
        Set(ByVal newValue As PointF)
            m_Center = newValue
        End Set
    End Property

    '圆上一点属性
    Public Property PCircle() As PointF
        Get
            Return m_PCircle
        End Get
        Set(ByVal newValue As PointF)
            m_PCircle = newValue
        End Set
    End Property

    '半径属性,只读
    Public ReadOnly Property Radius() As Single
        Get
            Dim r As Single= DistPtoP(m_Center, m_PCircle)
            Return r
        End Get
    End Property

    Public Sub New()
    End Sub

    Public Sub New(ByVal pCenter As PointF, ByVal pCircle As PointF)
        m_Center = pCenter
        m_PCircle = pCircle
    End Sub

    Public Sub Draw(ByVal g As Graphics, ByVal aPen As Pen)
        g.DrawEllipse(aPen, m_Center.X - Radius, m_Center.Y - Radius, Radius * 2, Radius * 2)
    End Sub

End Class

⌨️ 快捷键说明

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