Hello, I'm trying to make my own control, so first I tested the idea in winform application: I placed a panel(pnlExp) and inside it a button(btnGroup).
Then in the click event of the button I added the code:
And it worked. Then I tryed to do the same but as a usercontrol, so I create it in the same way and added the code:
builded and placed in a empty app, the problem is that I can't place any control inside it, so it collapse and expand, but the controls still on the form not inside my usercontrol.
Any advice?
Then in the click event of the button I added the code:
Code:
Private Sub btnGroup_Click(sender As Object, e As EventArgs) Handles btnGroup.Click
If IsCollapsed = False Then
IsCollapsed = True
btnGroup.Image = My.Resources.Collapse_Arrow_20px
pnlExp.Height = btnGroup.Height
Else
IsCollapsed = False
btnGroup.Image = My.Resources.Expand_Arrow_20px
pnlExp.Height = 600
End If
End Sub
Code:
Public Class ExpanderControl
Public Property IsCollapsed As Boolean
Private Sub btnGroup_Click(sender As Object, e As EventArgs) Handles btnGroup.Click
If IsCollapsed = False Then
IsCollapsed = True
btnGroup.Image = My.Resources.Collapse_Arrow_20px
Me.Height = btnGroup.Height
Else
IsCollapsed = False
btnGroup.Image = My.Resources.Expand_Arrow_20px
Me.Height = 600
End If
End Sub
End Class
Any advice?