How can I plot a graph on the screen?

  • Thread starter Thread starter elemis
  • Start date Start date
E

elemis

Hi, do we have pixels that we can set in order to plot an x-y graph
on a form ?
 
Hi elemis

You need to have a look at the OnPaint method - here's an example in VB.NET
that draws a diagonal line.

Protected Overrides Sub OnPaint(ByVal e As
System.Windows.Forms.PaintEventArgs)
e.Graphics.DrawLine(Pens.Black, 100, 100, 200, 200)
End Sub

But you would probably be better off buying a graphing control, or
developing your own rather than putting all your graphing code into the Form
Paint...

HTH

Nigel Armstrong
 
And to follow up my own post, make sure you call MyBase.OnPaint(e) before
your own painting code.

Nigel Armstrong
 
This is great, any ideas how a generate a paint event to refresh what
I am drawing?
 

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

Back
Top