I have 2 forms.
Form2 has no minimum, max, close icons.
Form2 have to control by form1.
i.e minimize of form1 becomes form2 minimize.
normal of form1 becomes form2 normal.
closing of form1 becomes form2 close.
All these are working.
but when form1 is behind the screen, i.e if form1 activates, form2 have to come front.
I have wrote activate event for this.
In this i have problem, if we use form activate event, when we click for minimize of form1, it calls form1 activate event and activates form2, but not minimize. It will go to infinite.
How to activate form2 when form1 activates, but when we minimize form1, form2 also have to minimize.
Form2= _rptForm
protected override void WndProc(ref Message m)
{
if (m.Msg == 0x0112) // WM_SYSCOMMAND
{
if (m.WParam == new IntPtr(0xF020)) //SC_MINIMUM
{
_rptForm.WindowState = FormWindowState.Minimized;
}
if (m.WParam == new IntPtr(0xF120)) //SC_RESTORE
{
_rptForm.WindowState = FormWindowState.Normal;
}
m.Result = new IntPtr(0);
}
base.WndProc(ref m);
}
private void DataBoxDlg_Activated(object sender, EventArgs e)
{
_rptForm.Activate();
}
Please change this code to work all which i mention above.