Elementary Graphics Question

  • Thread starter Thread starter eBob.com
  • Start date Start date
E

eBob.com

This real novice VB.NET programmer wants to put a "scatterplot" (just
a bunch of dots) on his form. There'll be other stuff on the form
too, but it's the scatterplot which I need your help on. Is
PictureBox the way to go? If so I am not finding any SIMPLE examples
using PictureBox in VB.NET.

If it matters ... I will eventually want to detect when the move moves
over one of the dots and will want the graph to grow and shrink as the
parent form grows and shrinks.

But at this point all I need is to make sure that I take the right
direction (i.e. PictureBox or some other technique) and to find a
SIMPLE, VB.NET example which illustrates that technique.

(I've found many graphics examples, by the way. But most draw all
over the entire form, I need to have some other controls on my form.
Or they are doing a bunch of stuff in addition to the graphics and
it's hard to separate out just the stuff necessary for the graphics.
Or they are not VB.NET. Or ... whatever. I just can't seem to find
any good, simple, VB.NET examples.)

Thanks, Bob
 
Hi eBob,

If I have understood your question correctly ,

you can put a PictureBox on the form and in its Paint event get hold of the
Graphics object from PaintEventArgs.

You may then wanna call the e.Graphics.DrawEllipse with appropriate pen for
some nice spots.

If you want only a pixel then you might use the following code

Dim bmp As New Bitmap(100, 100)
bmp.SetPixel(10, 10, Color.Red)
bmp.SetPixel(20, 20, Color.Gree)
bmp.SetPixel(30, 30, Color.Blue)
bmp.SetPixel(40, 40, Color.Yellow)
e.Graphics.DrawImageUnscaled(bmp, 100, 100)

I am not sure of the performance consideration for above code though.

HTH
rawCoder
 
Hello,

A 3rd party component may be of help. Our lite version costs as little as
$149.00 and you'll get over 10 man years of development.

ProEssentials is great at scatter plots. You can know when the mouse is
over a data point, user is dragging data points, and many other
end-user/developer features.

More info is at www.gigasoft.com. See the online and downloaded demos!

best regards,

Robert Dede
Gigasoft, Inc.
 
Back
Top