Activate form2 when form1 activates(Back to front)
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.
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0
Indead cVz, if you can do it the easy way, why do it the hard way.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
i dont have problem in minimizing,maximizing, Show and close. How to bring to front of the form2 when form1 activates.
I want only one operation.
When form1 is in normal state but behind another window, if we click that form1, form2 also have to come front along form1.
How to do this? Is it possible using tag itself. I dont have any buttons in the form.Please give me the solution for this.
Which event i have to call when form1 came front.
I want to do every operation of form1 reflects on form2.
minimize , maximize, normal, BringToFront, close etc...
All are working except Bring2Front.
Please suggest me the solution in simple way.
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0
A Form has a TopMost property. I did not try it but if it is set to true the form shows above all other forms.
ddanbe
Senior Poster
3,829 posts since Oct 2008
Reputation Points: 2,070
Solved Threads: 661
But i want event, when form1 come to front, to make form2 as topmost.
Need Event of form1, to make form2 as topMost.
when form1 come front from back screen.
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0
@cVz:
I didnt get you, will u please explain in brief.
Just minimize and maximize the form you want on top ...l it will work ...
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0
I want form2 should be in top, when form1 is also in top of other windows. To do this which event i have to call??
i.e if i click form1, both forms have to appear if it is behind the other windows.
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0
I have mentioned so many times, minimize and maximize is not a aproblem for me.
I already wrote this code for minimize and maximize of both forms and working fine, but the problem is as follows.
Form1 and form2 both in normal mode.
if i click on 3rd window, both form1 and form2 will go behind that 3rd window.
Again if i want to see form1 and form2, i have to click on form1, so that both forms have to come front of third window and have to visible of both form1 and form2.
I hope u understood my question.
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0
if we use activate event, it will go infinite. not able to minimize of form1 or close of form1.
ambarisha.kn
Junior Poster in Training
66 posts since Jun 2008
Reputation Points: 25
Solved Threads: 0