I\'d like your advice on the following issue: We are studying different User Interface solutions for an Windows Forms application we are developing and we have come to the concl
This is a bit of a hack, but works in XP. In Windows 7 it doesn't look too good, so you'd need to implement the tabbed thumbnails API instead.
Basically, it creates an invisible surrogate form for each MDI child control, and when a surrogate receives focus (when you select it in the task bar) it passes it on to the appropriate child window.
Assuming an MDI container named Form1, this code will do that:
private void Form1_Load(object sender, EventArgs e)
{
CreateWindow("child 1");
CreateWindow("child 2");
}
private void CreateWindow(string name)
{
Form window = new Form();
window.MdiParent = this;
window.Text = name;
window.Show();
Form surrogate = new Form();
surrogate.FormBorderStyle = FormBorderStyle.None;
surrogate.Text = name;
surrogate.Show(this);
surrogate.Size = Size.Empty;
surrogate.GotFocus += new EventHandler(surrogate_GotFocus);
surrogate.Tag = window;
window.Tag = surrogate;
}
void surrogate_GotFocus(object sender, EventArgs e)
{
Form surrogate = sender as Form;
if (null != surrogate && null != surrogate.Tag)
{
Form target = surrogate.Tag as Form;
target.Focus();
}
}
Again, I don't think straying from the design is a good thing here. You're better off sticking to the MDI restrictions, and implementing the appropriate APIs on newer OS installations. If you really need the windows to show up in the task bar, then you can use a hack such as this.