Strange UI behavior

T

Tamir Khason

I have a base form BaseForm:Form
I have a form derived from BaseForm -> myForm:BaseForm;

On BaseForm I have a panel public Panel1
On myForm I have a grid public Grid1, added to the Panel1 (from base form)
like this.pnl.Controls.Add(Grid1) -> and I can see it in design and run
time.

In other form (FooForm) I have a groupbox GroupBox1
onload of this form(FooForm) I'm creating
BaseForm frm1 = new myForm();
frm.Panel1.Parent = GroupBox1;
frm.Panel1.Dock=DockStyle.Fill;
frm.Panel1.Visible=true;

BUT. In FooForm apears Panel1 WITHOUT Grid1 - WHY? Where is the Grid1?

TNX
 
T

Tamir Khason

I can not use it.
I have baseclass not for fun, I just need it due I have abotu 40 forms like
that with different data in it;
 
J

Jon Skeet [C# MVP]

Tamir Khason said:
I have a base form BaseForm:Form
I have a form derived from BaseForm -> myForm:BaseForm;

On BaseForm I have a panel public Panel1
On myForm I have a grid public Grid1, added to the Panel1 (from base form)
like this.pnl.Controls.Add(Grid1) -> and I can see it in design and run
time.

In other form (FooForm) I have a groupbox GroupBox1
onload of this form(FooForm) I'm creating
BaseForm frm1 = new myForm();
frm.Panel1.Parent = GroupBox1;
frm.Panel1.Dock=DockStyle.Fill;
frm.Panel1.Visible=true;

BUT. In FooForm apears Panel1 WITHOUT Grid1 - WHY? Where is the Grid1?

Could you post a short but complete program which demonstrates the
problem?

See http://www.pobox.com/~skeet/csharp/complete.html for details of
what I mean by that.
 
K

Kevin Yu [MSFT]

Thanks for the answer, Jon!

Hi Tamir,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that the grid control is invisible when the
panel is aligned to fill the group box. If there is any misunderstanding,
please feel free to let me know.

Since Grid1 is the sub control for Panel, have you tried to use
Grid1.BringToFront() to show it?

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
T

Tamir Khason

Sorry for this.
This was my fault . In other place in program I just override settings from
BaseForm. So nothing displays.

Tnx to all
 
K

Kevin Yu [MSFT]

Hi Tamir,

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top