我目前正在创建一个班级项目列表
Public glstBeamsList As New List(Of BEAMLAYOUT)
Public Class BEAMLAYOUT
Public sourceLocation(2) As Double
Public pointEastingNorthingDepth As New List(Of Double())
End Class
此类列表项最多可包含256个点,数组中有3个项目。
我的问题是glstBeamsList不断被添加到,并且我通过列表读取的例程将点绘制到位图,并且一旦列表变大,在屏幕上显示需要很长时间。
这是我正在使用的代码,感谢任何帮助。
Dim Eastlimit, WestLimit, NorthLimit, SouthLimit As Double
Eastlimit = dblSourceLocationEastings + (gintPlanWidth / 2)
WestLimit = dblSourceLocationEastings - (gintPlanWidth / 2)
NorthLimit = dblSourceLocationNorthings + (gintPlanHeight / 2)
SouthLimit = dblSourceLocationNorthings - (gintPlanHeight / 2)
For i = 0 To glstBeamsList.Count - 1
If glstBeamsList(i).sourceLocation(0) = 0 Or
glstBeamsList(i).sourceLocation(1) = 0 Then GoTo nextPoint
For ii = 0 To glstBeamsList(i).pointEastingNorthingDepth.Count - 1
Dim point() = glstBeamsList(i).pointEastingNorthingDepth(ii)
If point(0) < Eastlimit Then
If point(0) > WestLimit Then
If point(1) < NorthLimit Then
If point(1) > SouthLimit Then
Dim x, y As Double
If point(0) < glstBeamsList(i).sourceLocation(0) Then x = point(0) - glstBeamsList(i).sourceLocation(0)
If point(0) > glstBeamsList(i).sourceLocation(0) Then x = glstBeamsList(i).sourceLocation(0) - point(0)
If point(1) < glstBeamsList(i).sourceLocation(1) Then y = point(1) - glstBeamsList(i).sourceLocation(1)
If point(1) > glstBeamsList(i).sourceLocation(1) Then y = glstBeamsList(i).sourceLocation(1) - point(1)
Dim clrPointColor As New Color
Select Case point(2)
Case -10 To 0
clrPointColor = Color.Red
Case -20 To -11
clrPointColor = Color.Orange
Case -30 To -21
clrPointColor = Color.Yellow
Case -40 To -31
clrPointColor = Color.Green
Case -50 To -41
clrPointColor = Color.Blue
Case -60 To -51
clrPointColor = Color.Indigo
Case -70 To -61
clrPointColor = Color.Purple
Case -80 To -71
clrPointColor = Color.Violet
Case -90 To -81
clrPointColor = Color.Gray
Case -100 To -91
clrPointColor = Color.Black
Case -110 To -101
clrPointColor = Color.Red
End Select
Dim xLoc As Integer = ((gintPlanWidth / 2) + x) * gsngPlanScaleFactor
Dim yLoc As Integer = ((gintPlanHeight / 2) + y) * gsngPlanScaleFactor
If xLoc > 0 And xLoc < PicBox.Width Then
If yLoc > 0 And yLoc < PicBox.Height Then
ggfxPlanViewBitmap.SetPixel(xLoc, yLoc, clrPointColor)
End If
End If
End If
End If
End If
End If
Next