something like this. this is the xml i used to test it:
<?xml version="1.0" encoding="utf-8"?>
<Points>
<Value x="10" y="10"/>
<Value x="20" y="20"/>
<Value x="30" y="30"/>
<Value x="40" y="40"/>
<Value x="50" y="50"/>
</Points>vb Code:
Public Class Form1 Dim xmlPoints() As Point Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork Dim xml As XDocument = XDocument.Load("xml.txt") Dim points() As Point = (From node In xml...<Value> Select New Point(CInt(node.@x), CInt(node.@y))).ToArray e.Result = points End Sub Private Sub BackgroundWorker1_RunWorkerCompleted(ByVal sender As Object, ByVal e As System.ComponentModel.RunWorkerCompletedEventArgs) Handles BackgroundWorker1.RunWorkerCompleted xmlPoints = DirectCast(e.Result, Point()) Me.Invalidate() End Sub Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load BackgroundWorker1.RunWorkerAsync() End Sub Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint If xmlPoints Is Nothing Then Return e.Graphics.DrawLines(Pens.Red, xmlPoints) End Sub End Class




Reply With Quote