Torna al Thread

Imports System.IO Public Class Form3 Private Sub Form3_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint Dim blackPen As New Pen(Color.Red, 3) Dim x1 As Single Dim y1 As Single Dim x2 As Single Dim y2 As Single Try ' Create an instance of StreamReader to read from a file. Using sr As StreamReader = New StreamReader("C:\coordinate.txt") Dim line() As String ' Read and display the lines from the file until the end ' of the file is reached. Do line = Split(sr.ReadLine(), ";", -1) x1 = line(0) y1 = line(1) x2 = line(2) y2 = line(3) e.Graphics.DrawLine(blackPen, x1, y1, x2, y2) Loop Until line Is Nothing sr.Close() End Using Catch ex As Exception ' Let the user know what went wrong. Console.WriteLine("The file could not be read:") Console.WriteLine(ex.Message) End Try End Sub End Class
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5