Menu

#9 Using a dockContainer with DockableWindow and mdiChildren

open
5
2007-03-09
2007-03-09
pierre9857
No

I'm trying some docking elements of the Fireball library.

I'm using mdi Forms and DockableWindows in the same dockContainer.

I've set up two Form types:
- FormTst, which inherits DockableWindows.
- FormNormale, which inherits Form.

In my main Form, I've put a DockContainer: dockContainer1.

I have a button, button1, that opens a Mdi Child of Main of type FormNormale.
I'm also displaying (directly when loading the main form) a FormTst instance, ft.

When Mdi Children get the focus, the colors do not recover their border color.

Here is my code:

public partial class Main : Form
{
FormTst ft;

public Main()
{
InitializeComponent();
ft = new FormTst();
ft.DockPanel = this.dockContainer1;
ft.DockableAreas = DockAreas.DockLeft;
ft.DockState = DockState.DockLeftAutoHide;
}

private void Main_Load(object sender, EventArgs e)
{
this.MdiChildActivate += new EventHandler(Main_MdiChildActivate);

}

void Main_MdiChildActivate(object sender, EventArgs e)
{
this.dockContainer1.Controls.Add(this.ActiveMdiChild);
this.ActiveMdiChild.Click += new EventHandler(ActiveMdiChild_Click);
this.ActiveMdiChild.FormClosed += new FormClosedEventHandler(ActiveMdiChild_FormClosed);
}

void ActiveMdiChild_Click(object sender, EventArgs e)
{
((Form)sender).BringToFront();
((Form)sender).Select();
}

void ActiveMdiChild_FormClosed(object sender, FormClosedEventArgs e)
{
this.dockContainer1.Controls.Remove((Form)sender);
}

private void button1_Click(object sender, EventArgs e)
{
FormNormale afn = new FormNormale();
afn.MdiParent = this;
afn.Show();
}
}

Discussion


Log in to post a comment.

MongoDB Logo MongoDB