我在datagridview中有数千个x和y坐标,我需要用它们绘制线条。例如,第1行,单元格1包含x,第1行单元格2包含y并继续。我需要从第1行到第2行,第2行到第3行。必须像设计一样。我使用For i = 1到1000。我用了画线功能。
Dim bmp As New Drawing.Bitmap(640, 480)
Dim gfx As Graphics = Graphics.FromImage(bmp)
Dim i As Integer
Dim prcoordx As Integer
Dim prcoordy As Integer
Dim nextcoordx As Integer
Dim nextcoordy As Integer
For i = 1 To 1000 Step 1
prcoordx = DataGridView1.Rows(i).Cells(1).Value
prcoordy = DataGridView1.Rows(i).Cells(2).Value
nextcoordx = DataGridView1.Rows(i+1).Cells(1).Value
nextcoordy = DataGridView1.Rows(i+1).Cells(2).Value
Next i
gfx.DrawLine(Pens.Black, prcoordx, prcoordy, nextcoordx, nextcoordy)