Visual Basic のFormで、現dirからcsvファイルを読み込んで、図形を描くコードの作成をしています。
初心者のため、csvファイルの入出力が分かりませんので、
最初に座標nodeと要素element(node番号を線分で接続)するFormを以下のように作成しました。
動作は正しく動きました。
以下のコードで、Point部分に①のnode.csvからx、y座標を読み込んで、
②elementのように2点のnodeを線分で繋いで図を作成したいのですが、
初心者のため躓いていました。
ご知見を頂けますと有難く存じます。
Public Class Form1
Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles MyBase.Paint
Dim point1 As New Point(200, 400) 'node1
Dim point2 As New Point(200, 100) 'node2
e.Graphics.DrawLine(Pens.Blue, point1, point2) 'elem1
Dim point11 As New Point(650, 400) 'node11
Dim point12 As New Point(650, 100) 'node12
e.Graphics.DrawLine(Pens.Blue, point11, point12) 'elem2
Dim point3 As New Point(250, 100) 'node3
Dim point4 As New Point(300, 100) 'node4
Dim point5 As New Point(350, 100) 'node5
Dim point6 As New Point(400, 100) 'node6
Dim point7 As New Point(450, 100) 'node7
Dim point8 As New Point(500, 100) 'node8
Dim point9 As New Point(550, 100) 'node9
Dim point10 As New Point(600, 100) 'node10
e.Graphics.DrawLine(Pens.Blue, point2, point3) 'elem3
e.Graphics.DrawLine(Pens.Blue, point3, point4) 'elem4
e.Graphics.DrawLine(Pens.Blue, point4, point5) 'elem5
e.Graphics.DrawLine(Pens.Blue, point5, point6) 'elem6
e.Graphics.DrawLine(Pens.Blue, point6, point7) 'elem7
e.Graphics.DrawLine(Pens.Blue, point7, point8) 'elem8
e.Graphics.DrawLine(Pens.Blue, point8, point9) 'elem9
e.Graphics.DrawLine(Pens.Blue, point9, point10) 'elem10
e.Graphics.DrawLine(Pens.Blue, point10, point12) 'elem11
End Sub
End Class
①node.csv
200 400
200 100
250 100
300 100
350 100
400 100
450 100
500 100
550 100
600 100
650 400
650 100
②element.csv
1 2
11 12
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 12