Looking at question/response 24490437 I see that one can programmatically create a line shape and apply it to a shape container. However the solution there does not allow one to place a new line shape on an existing panel. How would one place a new line shape on an existing panel(vb.net winforms)?
' example solution from 24490437
Dim startx As Integer = 0
Dim starty As Integer = 0
Dim endx As Integer = 100
Dim endy As Integer = 100
Dim yourline As New LineShape(startx, starty, endx, endy)
' this section places "yournewline" on a canvas.
Dim yourcanvas As ShapeContainer
canvas.Parent = formName
yourline.Parent = canvas
Here is my attempt at coding this:
Private Sub frmbig_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
' define a new line shape
Dim startx As Integer = 0
Dim starty As Integer = 0
Dim endx As Integer = 100
Dim endy As Integer = 100
Dim yourline As New LineShape(startx, starty, endx, endy)
' attempt to place the line shape on the existing panel1 which is on frmbig
yourline.Parent = Panel1
' !! blue underline under Panel1 when highlighted states:
' Value of type 'System.Windows.Forms.Panel' cannot be converted to
' 'Microsoft.VisualBasic.PowerPacks.ShapeContainer'.
End Sub