I created a rectangle shape and tried to show it at my form like this
Imports Microsoft.VisualBasic.PowerPacks
Public Class frmBoard
Dim baseDice As RectangleShape
Private Sub frmBoard_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
baseDice.CornerRadius = 5
baseDice.Height = 50
baseDice.Width = 50
baseDice.BackColor = Color.Blue
Me.components.Add(baseDice)
End Sub
End Class
This didn’t work. I missed something, but I dont know what…
Updated Code, after @Jay Riggs answer
Imports Microsoft.VisualBasic.PowerPacks
Public Class frmBoard
Dim baseDice As RectangleShape
Dim shapeContainer As ShapeContainer
Private Sub frmBoard_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
shapeContainer.Parent = Me
baseDice.Parent = shapeContainer
baseDice.CornerRadius = 5
baseDice.Height = 50
baseDice.Width = 50
baseDice.BackColor = Color.Blue
baseDice.Left = 50
baseDice.Top = 50
'Me.components.Add(baseDice)
End Sub
End Class
This also didn’t work
The MSDN documentation for the RectangleShape Class demonstrates what you need to do: set the
RectangleShape‘sLeftandTopproperties.EDIT
Update your code to instantiate your ShapeContainer and RectangleShape objects: