Napivo1972 Posted October 28, 2004 Posted October 28, 2004 I use the following Paint Event to draw a vector graphics image. Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint Dim p As New Pen(Color.Black, 1) e.Graphics.TranslateTransform(-hsb.Value * 10, -vsb.Value * 10) Dim m As New Matrix m.Scale(zoom, zoom) zoom = 1 Dim t1 As Integer Dim pth As GraphicsPath For t1 = 0 To 0 For Each pth In y(t1).gPaths pth.Transform(m) e.Graphics.DrawPath(p, pth) Next Next For t1 = 5 To 5 For Each pth In y(t1).gPaths e.Graphics.DrawPath(p, pth) Next Next End Sub This works great but I need to find the height and the width of the drawn picture to set the scroll bars min and max values. Does any of you have an easy method to do this? Quote
Ming_Lei Posted November 11, 2004 Posted November 11, 2004 Maybe using GraphicsPath.GetBounds()? Quote
Napivo1972 Posted November 12, 2004 Author Posted November 12, 2004 thanks Ming_Lei You put me on the right track. Dim rect As RectangleF rect = RectangleF.Union(rect, pth.GetBounds) Works like a charm Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.