drawing on a picbox from a class

K

Kevin

I have a form with a Picturebox on it. I also have a class that
contains data that I want to graph in the picture box. How do I pass
the PictureBox to a method of the class and have the method draw in the
picture box

in the form I have
Private B As New Box
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
B.Draw(Me.pb) 'pb is the picturebox
End Sub
End Class

here is the class I am building, but the Draw method doesn't work
Class Box
Public Sub Draw(ByVal pb As PictureBox)

Dim e As PaintEventArgs
Dim blackPen As New Pen(Color.Black, 3)
e.Graphics.DrawLine(blackPen, 0, 0, pb.Width, pb.Height)

End Sub
End Class

Can anyone explain to me how to do this?
thanks
kevin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top