views:

27

answers:

2

I've got a user control class that works fine, drawing, events firing and the works. When i programmaticly add it to a class that extends from Panel it disapears. I've checked around and the line that makes it disapear is the line where i go

panel.Controls.Add(myuserControl).

Without that line the control works just fine, does anybody know why it won't show after the add? I'm currently doing the painting of the user control by overriding OnPaint, but the panel is using the default painting.

A: 

consult View=>OterWindows=>DocumentOutline and see if the controls is present in designer.

I intuit that your control is not disappears, but you don't see it (consult Location, Dock, Anchor, Visibility, BackColor properties after .Add), two different things.

serhio
Yep, it was a problem with local coordinates for the panel. My control was out of view. I never got DocumentOutline working though, but the general idea of your post was right. Thanks.
dutt
A: 

Change the background color of the Panel, and set it to visible to see if you can see the panel. For instance,

<asp:Panel ID="Panel1" runat="server" ScrollBars="Auto" Width="450" Height="200" Wrap="true" BackColor="Aqua" Direction="LeftToRight">
KMan
except this is windows forms, not asp.
dutt