Adding dialog to form

R

RahimAsif

Hi guys,
I am developing a C# application using VS .NET 2003. Its a typical
windows SDI application with a menu and toolbar at the top, treeview on
the left and a status bar at the bottom. In my tree-view, I show a list
of panels, and expanding the panel displays the list of projects for
that panel. in my menu, I have options for the user to add/edit panels
and projects which bring up the appropriate dialogs.

Here is what I am trying to achieve. When the user clicks on a
tree-view on the item (panel or project) I want to show the edit dialog
of the corresponding panel or project on the right hand side. However,
the dialog should be immovable, and should remain fixed to the right
hand side. What I don't know is how to add one form (the edit dialog of
the panel or project) to another form (the child window of the SDI
application) and keep it fixed to one location. Is it even possible?

Thanks in advance.
 
G

Guest

The solution is that managing your editable content in user control.
for example
1. create user controls
public class ProjectUserControl: System.Windows.Forms.UserControl {
//encapsulate all functionalities in this user control
}

2. in the sdi main form
public class MainForm : System.Windows.Forms.Form {

TreeView treeView = new TreeView();
//this is the place to display the editable content
Panel contentPanel = new Panel();

protected void SelectNode(object sender, TreeViewEventArgs e) {
contentPanel.Controls.Clear();
contentPanel.Controls.Add(new ProjectUserControl());
}

}

Thats it, just a bit of creating and adding user control at run time.

hope this helps
 

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