Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 15543

Trying to make a "ExpanderPanel" control

$
0
0
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:
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

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:
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

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?

Viewing all articles
Browse latest Browse all 15543

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>