Help with making a PC oscilloscope , graphing display how??

Hi I have built a simple A/D converter that connects to the PC's lpt port and i have stored the values in a array,
i want to display these values as a oscilloscope type display, anyone point me at a bit of sample code for generating such a display?
many thanks

Who is Participating?
Why not using the pretty strong GDI+?
Here is an example.

To run it you need to add Imports System.Math to the top of the form class.
Then create a PictureBox with the default name PictureBox1 abour 4 x 4 inches in size. Give it a green background color. (I use BackColor = Color.SeaGreen. It looks like my Tek 465!)

Add the following code to your form and run it.

    Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
        Dim ix As Integer = PictureBox1.Width
        Dim iy As Integer = PictureBox1.Height

        ' Make up some values
        Dim Values(ix) As Double
        For i As Integer = 0 To Values.GetUpperBound(0)
            Values(i) = Sin(i * 25)

        ' Display the values
        Dim OldPoint = New Point(0, iy \ 2)
        For i As Integer = 1 To Values.GetUpperBound(0)
            Dim y As Integer = iy \ 2 + CInt(Values(i) * (iy \ 3)) ' do some scale factor to make it look good
            Dim NewPoint = New Point(i, y)
            e.Graphics.DrawLine(Pens.Yellow, OldPoint, NewPoint)
            OldPoint = NewPoint

        ' Make the Grid
        For x As Integer = 25 To ix Step 25
            e.Graphics.DrawLine(Pens.LightGreen, x, 0, x, iy)
        For y As Integer = iy - 25 To 0 Step -25
            e.Graphics.DrawLine(Pens.LightGreen, 0, y, ix, y)
    End Sub

have fun
Bob LearnedCommented:
There is a sample here, using Managed DirectX to plot a sine wave:;article=20

Down toward the bottom are links for the code:

Source for VB.Net (9K)
To compile this lesson you will also need the Drunken Hyena .Net Common Code

You are also going to need the DirectX 9 SDK:

Microsoft DirectX Downloads

The process of using DirectX is very powerful, but also very complex, and the learning curve is very daunting, but with power comes speed and versatility.

2E0AQUAuthor Commented:
Thanks to both of you for the help, i have split the points as although im not using TheLearnedOnes answer it will give me  some pointers for more complex stuff when im ready.
Thanks to both of you.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.