Have you tried percentages?
I placed a picture box on a form. Named it picturebox1
and used this code
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
'Draw rectangle
Dim Rec As New Rectangle(0, 0, e.Graphics.ClipBounds.Width,
e.Graphics.ClipBounds.Height)
e.Graphics.DrawRectangle(Pens.Green, Rec)
'Draw 2 lines
Dim p1 As New PointF(Rec.Width * 0.01, Rec.Height * 0.1) '1% of width,
10% of height
Dim p2 As New PointF(Rec.Width * 0.8, Rec.Height * 0.9) '80% of width,
90% of height
'Wrote out the ponts.
Console.WriteLine(Rec.ToString & " " & p1.ToString)
Console.WriteLine(rec.ToString & " " & p2.ToString)
'Draw line to box
e.Graphics.DrawLine(Pens.Blue, p1, p2)
End Sub
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Resize
'Code used to redraw.
Me.PictureBox1.Invalidate()
End Sub
Does this help?
Good luck!
--
Thiele Enterprises - The Power Is In Your Hands Now!
--
"Craig Lucas" <cr********@tds.netwrote in message
news:dw*****************@newsreading01.news.tds.ne t...
Im kind of new to vb.net drawing routines. Im reading a collection of 2d
points from a
proprietary file. These points are simply for drawing lines, I can draw the
lines fine using Graphics.DrawLine, but I need to scale all the lines to fit
a rectangle of a given width and height.
What is the best method to do something like this? Its also important that
the drawing retain proportion within the given rectangle.
Thanks
Craig