| | |
Activate form2 when form1 activates(Back to front)
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Jun 2008
Posts: 66
Reputation:
Solved Threads: 0
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
Please change this code to work all which i mention above.
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
c# Syntax (Toggle Plain Text)
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.
Ambarish
Can i maybe give you a new approach ???
Ive done this like this
in the formload of form1
now you can access form 2, so now you can say on a button -
Now you can also say this on a button on form1
Happy coding my friend ...
Ive done this like this
in the formload of form1
C# Syntax (Toggle Plain Text)
this.Tag = form2;
now you can access form 2, so now you can say on a button -
C# Syntax (Toggle Plain Text)
Form2.Show(); // If you want both to be active for use Form2.ShowDialog(); // If you want form1 to be disabled
Now you can also say this on a button on form1
C# Syntax (Toggle Plain Text)
form2.close(); // If you want to close it form2.WindowState = FormWindowState.Minimized;
Happy coding my friend ...
Delphi & C# programmer deluxe...
•
•
Join Date: Jun 2008
Posts: 66
Reputation:
Solved Threads: 0
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.
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.
Last edited by ambarisha.kn; Jan 17th, 2009 at 4:12 am.
Ambarish
You have your form declaration here
then you have this on the FormWindows State changed or on a button click
Hope it helps , mark as solved if it did... viola
c# Syntax (Toggle Plain Text)
Form2 F2 = new Form2(); F2.Show(); F2.WindowState = FormWindowState.Minimized;
then you have this on the FormWindows State changed or on a button click
c# Syntax (Toggle Plain Text)
if (this.WindowState == FormWindowState.Normal) { F2.WindowState = FormWindowState.Normal; }
Hope it helps , mark as solved if it did... viola
Last edited by cVz; Jan 19th, 2009 at 3:31 am.
Delphi & C# programmer deluxe...
![]() |
Other Threads in the C# Forum
- Previous Thread: time complexity
- Next Thread: can C# perform command prompt lines
Views: 3222 | Replies: 16
| Thread Tools | Search this Thread |
Tag cloud for C#
.net access algorithm array barchart bitmap box button buttons c# chat check checkbox class client code color combobox control conversion csharp custom database datagridview dataset datetime degrees draganddrop drawing encryption enum excel file files form format forms ftp function gcd gdi+ httpwebrequest image index input install java label list listbox listener login mandelbrot math mouseclick mysql networking object operator oracle path photoshop picturebox post prime programming radians regex remote remoting resource richtextbox save saving serialization server sleep socket sql statistics stream string table tcp text textbox thread time timer treeview update usercontrol validation view visualstudio webbrowser windows winforms wpf xml






