|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Scaling a collection of points(lines)?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 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" <craiglu***@tds.net> wrote in message Im kind of new to vb.net drawing routines. Im reading a collection of 2dnews:dwb_g.7608$5i7.6566@newsreading01.news.tds.net... 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
Best way to store dataset to disk???
Query results to file frmViewAll.DefInstance.Hide() Datasets and Adapter Updates Newb looking for data binding help Webbrowser control - buffering - audio/video playback problem... how to translate from c# this instruction Deleteing all files from target folder as a presetup task Building my own "SMTP" mail - control ? Using VB and ADO.NET |
|||||||||||||||||||||||