亲爱的论坛成员我必须做一个三角班。
我的问题是我的公共覆盖子 teken 不起作用
在我的课堂形式中(功能随机)
Private Function RandomStraal() As Int32
Return 20 + _Random.Next(Me.ClientSize.Width\2)
End Function
在我的班级表格中(SUB MAAKTRIANGLE)
Private Sub MaakTriangle(x As Integer, y As Integer)
Dim tria As New Triangle(RandomKleur, RandomKleur, New Point(x, y), New Point(x, y + RandomStraal()), New Point(x + RandomStraal(), y))
tria.PenDikte = _Random.Next(1, 6)
_Tekening.Add(tria)
'_Tekening.Teken(Me.CreateGraphics)
Invalidate()
End Sub
我的班级三角
Friend Class Triangle
Inherits Figuur
Public Property Point1() As Point
Public Property Point2() As Point
Public Property Point3() As Point
Private _Pointers() As Point = {Point1, Point2, Point3}
Public Sub New(penKleur As Color, vulKleur As Color, point1 As Point, point2 As Point, point3 As Point)
MyBase.New(penKleur, vulKleur)
Me.Point1 = point1
Me.Point2 = point2
Me.Point3 = point3
End Sub
Public Overrides Sub Teken( doek As Graphics)
Using borstel As New SolidBrush(VulKleur),
pen As New Pen(PenKleur, PenDikte)
Dim tria As New Rectangle(_Pointers) **'<--the problem**
doek.FillPolygon(borstel, tria)
doek.DrawPolygon(pen, tria)
End Using
End Sub
End Class
做这项工作应该怎么做
提前致谢