Custom control disappears when added to panel

I have a user management class that works fine, draws, fires events and works. When I programmatically add it to a class that exits Panel, it disappears. I checked around and the line that makes it faulty is the line I'm going on

panel.Controls.Add(myuserControl).

      

Without this line, the control works fine, does anyone know why it won't show up after adding it? I am currently painting a custom control overriding OnPaint, but the panel uses the default drawing.

+2


a source to share


2 answers


refer to View => OterWindows => DocumentOutline and see if there are controls in the designer.



I understand that your control does not disappear, but you can not see it (consult with Location

, Dock

, Anchor

, we see the BackColor property after .Add

), two different things.

+1


a source


Change the background color of the panel and set it to view to see if the panel can be seen. For instance,



<asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Width="450" Height="200" Wrap="true" BackColor="Aqua" Direction="LeftToRight">

      

0


a source







All Articles