G
Guest
Hi,
I am trying to build an app (in VS 2005) with various "views" each
containing different "panels" similar to let's say MS Outlook or VS.
Each "panel" in these views is a form and I want to be able to use VS to
create and manage these forms individually.
The idea is that I would design and write handlers for each of these forms
independantly. I can then design the parent windows (these will be my
"views") that holds a set of the child forms (note: a child form may be
re-used in multiple parent windows).
I tried using a splitter in a form as the parent window. The splitter
creates 2 panels and what I want to be able to do is to show 2 completely
independant forms in these 2 panels.
What I did was to create 2 forms - Form1 and Form2 - each having exactly one
panel inside and a set of controls within that panel. I then created my
ViewForm with a splitter and in the c'tor of ViewForm, I did:
Form1 f1 = new Form1();
Form2 f2 = new Form2();
this.splitContainer1.Panel1.Controls.Add(f1.Controls[0]); // add the panel
in form1 to the panel 1
this.splitContainer1.Panel2.Controls.Add(f2.Controls[0]); // add the panel
in form2 to the panel 2.
Now when I show ViewForm, the controls in Form1 show up in the left pane and
the controls in Form2 show up in the right pane.
The problem however is that the event handler code for the controls is in
the individual forms (Form1 & Form2) and not in ViewForm.
I want my ViewForm to hold completely independant and self-sufficient forms
in it's "panels".
What is the best way to achieve what I want? Should I be using splitter
windows at all? Or should I be using MDI?
Note: I do not need the individual child forms to be dockable/floating. As
long as the user can resize them using a splitter I am ok.
thanks,
hari
I am trying to build an app (in VS 2005) with various "views" each
containing different "panels" similar to let's say MS Outlook or VS.
Each "panel" in these views is a form and I want to be able to use VS to
create and manage these forms individually.
The idea is that I would design and write handlers for each of these forms
independantly. I can then design the parent windows (these will be my
"views") that holds a set of the child forms (note: a child form may be
re-used in multiple parent windows).
I tried using a splitter in a form as the parent window. The splitter
creates 2 panels and what I want to be able to do is to show 2 completely
independant forms in these 2 panels.
What I did was to create 2 forms - Form1 and Form2 - each having exactly one
panel inside and a set of controls within that panel. I then created my
ViewForm with a splitter and in the c'tor of ViewForm, I did:
Form1 f1 = new Form1();
Form2 f2 = new Form2();
this.splitContainer1.Panel1.Controls.Add(f1.Controls[0]); // add the panel
in form1 to the panel 1
this.splitContainer1.Panel2.Controls.Add(f2.Controls[0]); // add the panel
in form2 to the panel 2.
Now when I show ViewForm, the controls in Form1 show up in the left pane and
the controls in Form2 show up in the right pane.
The problem however is that the event handler code for the controls is in
the individual forms (Form1 & Form2) and not in ViewForm.
I want my ViewForm to hold completely independant and self-sufficient forms
in it's "panels".
What is the best way to achieve what I want? Should I be using splitter
windows at all? Or should I be using MDI?
Note: I do not need the individual child forms to be dockable/floating. As
long as the user can resize them using a splitter I am ok.
thanks,
hari