lines drawing

  • Thread starter Thread starter Vishruth
  • Start date Start date
V

Vishruth

I want to plot the lines in the form automatically by
retrieving the values of X and Y coordinates from the
Access database.The X and Y fields in my access database
has about 50 or more records.I would request you to please
provide me the coding as I'm new to this VB.net.
Please help me.
Thanking You.
 
This is the code I was using in generation of linear picture of number
PI.

It will show you how I read file for certain numbers of Pi and how I
draw the lines.

All you have to do is to rework this so you read your own values from
access database. I hope someone else will help you with that part
soon.

This is the code, and don't forget to put picturebox on to your form:


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
'Draw line on picturebox
'Put a picturebox on the form named pic
Button1.Visible = False


Static start_time As DateTime
Static stop_time As DateTime
Dim elapsed_time As TimeSpan

start_time = Now

Dim bit As Bitmap = New Bitmap(pic.Width, pic.Height)
Dim g As Graphics = Graphics.FromImage(bit)
Dim bb, x, x1, x2, x3 As Integer
Dim width As Integer
Dim height As Integer
Dim width1 As Integer
Dim height1 As Integer
Dim myPen As Pen

' textbox2.text has a path to my number pi file

Dim fs = New FileStream(TextBox2.Text, FileMode.Open,
FileAccess.Read)
Dim r As New BinaryReader(fs)
Dim koniec As Integer = (Math.Round(fs.length) /
2) - 2


x3 = 100
While x3 <= 255 And bb < koniec
x3 = x3 + 1
While x2 <= 255 And bb < koniec
x2 = x2 + 1
StatusBar1.Text = koniec - bb
While x1 <= 255 And bb < koniec
x1 = x1 + 1
While x <= 255 And bb < koniec
x = x + 1
bb = bb + 2
myPen = New Pen(Color.FromArgb(x3 - 1,
x2 - 1, x1 - 1, x - 1), 1)
width = r.ReadByte()
height = r.ReadByte()
g.DrawLine(myPen, 0, width, 256,
height)
End While
x = 0
End While
x1 = 0
End While
x2 = 0
End While
x3 = 0

r.Close()
fs.close()

pic.Image = bit
pic.Image.Save(OpenFileDialog1.FileName +
".png")
stop_time = Now
elapsed_time = stop_time.Subtract(start_time)
StatusBar1.Text = "Calculation length in seconds:
" +
elapsed_time.TotalSeconds.ToString("0.000000")

Button1.Visible = True
End Sub





vjay


backup at www.dotnetboards.com
 
Vishruth said:
I want to plot the lines in the form automatically by
retrieving the values of X and Y coordinates from the
Access database.The X and Y fields in my access database
has about 50 or more records.I would request you to please
provide me the coding as I'm new to this VB.net.
Please help me.
Thanking You.

HELLO? Please read the answers you got. Please answer the questions.
 
Back
Top