Goodday,
I've got a strange problem! I've got a MDIForm which has form docked to it. The only thing this form does is to be the default background of my MDIForm (I realy don't know how to set the background of the MDIParent) I Don't want it to be clickable so I set the .Enabled propert to false.
Now everytime I make a new form and show it in the MDIParent and I'll close that same form the MdiChildActivate event isn't raised. If I set the .Enabled property of the (background) form to true then it will raise the MdiChildActivate event !!!
You can help me also by giving me a example how to set the background of an MDIParent. This background has to be visible around a form. The background has the color of a default form.
thnx
proof of concept:
using
System;using
System.Collections.Generic;using
System.ComponentModel;using
System.Data;using
System.Drawing;using
System.Text;using
System.Windows.Forms;namespace
WindowsApplication2{
public partial class MDIParent1 : Form{
public MDIParent1(){
InitializeComponent();
}
private void newToolStripMenuItem_Click(object sender, EventArgs e){
Form form = new Form();form.MdiParent =
this;form.Dock =
DockStyle.Fill;form.FormBorderStyle =
FormBorderStyle.None; //form.Enabled = false;form.Show();
}
private void newFormToolStripMenuItem_Click(object sender, EventArgs e){
Form form = new Form();form.MdiParent =
this;form.Location =
new Point(400, 400);form.Size =
new Size(500, 500);form.BackColor =
Color.Maroon;form.Show();
}
private void MDIParent1_MdiChildActivate(object sender, EventArgs e){
MessageBox.Show("MdiChildActivate event raised");}
/* I made this code in VS2005 Version 8.0.50727.42* Start a new project choose MDI form, remove all controls in the form
* then add a menuStrip with two two items I called them
* 'new' and 'newform'. Add the MdiChildActivate event of the mdiform and set
* for example a messagebox. Also don't forget to alter the startup in Program.cs
* Now if you start the program and you click new a MdiChildActivate event is raised
* that's ok then click newform you'll again get a message of the MdiChildActivate being raised
* and when you close that newform it will raise that event again. It's fabulous :D
* But now change/Add in the newToolStripMenuItem_Click event form.Enabled = false
* Start the app again and do the sme routine as before :S I am bazzeled :(
* How and why does this happen!
*/
}
}

Proof of Concept: MDIForm does not call MdiChildActivate event
KKL