M
Mike Tuersley
Hi,
I have a series of x, y coordinates that I am trying to draw in a
picturebox. I am able to draw lines okay - the problem is trying to draw the
overall shape to the extents of the picturebox. My "image" comes in way too
small. What am I missing? Below are out takes of my code that should show
what I have so far:
Dim width As Integer = PicBox1.Width
Dim height As Integer = PicBox1.Height
Dim bmp As New Bitmap(width, height)
Dim g As Graphics = Graphics.FromImage(bmp)
' set up the drawing surface to draw in the picturebox
g.PageUnit = GraphicsUnit.Point
g.PageScale = 4
_myPen = New Pen(_myForeColor, 1)
g.DrawLine(_myPen, _
_myContour.Vertices.Item(iCntr).PtX, _
_myContour.Vertices.Item(iCntr).PtY, _
_myContour.Vertices.Item(0).PtX, _
_myContour.Vertices.Item(0).PtY)
PicBox1.Image = bmp
Public Structure Contour
Dim Vertices As List(Of Vertex)
End Structure
Public Structure Vertex
Dim PtX As Single
Dim PtY As Single
Public Sub New(ByVal X As Single, ByVal Y As Single)
Me.PtX = X
Me.PtY = Y
End Sub
End Structure
I have a series of x, y coordinates that I am trying to draw in a
picturebox. I am able to draw lines okay - the problem is trying to draw the
overall shape to the extents of the picturebox. My "image" comes in way too
small. What am I missing? Below are out takes of my code that should show
what I have so far:
Dim width As Integer = PicBox1.Width
Dim height As Integer = PicBox1.Height
Dim bmp As New Bitmap(width, height)
Dim g As Graphics = Graphics.FromImage(bmp)
' set up the drawing surface to draw in the picturebox
g.PageUnit = GraphicsUnit.Point
g.PageScale = 4
_myPen = New Pen(_myForeColor, 1)
g.DrawLine(_myPen, _
_myContour.Vertices.Item(iCntr).PtX, _
_myContour.Vertices.Item(iCntr).PtY, _
_myContour.Vertices.Item(0).PtX, _
_myContour.Vertices.Item(0).PtY)
PicBox1.Image = bmp
Public Structure Contour
Dim Vertices As List(Of Vertex)
End Structure
Public Structure Vertex
Dim PtX As Single
Dim PtY As Single
Public Sub New(ByVal X As Single, ByVal Y As Single)
Me.PtX = X
Me.PtY = Y
End Sub
End Structure