Minimizing forms

  • Thread starter Thread starter Nathan
  • Start date Start date
N

Nathan

Hello again,

I have an application with three forms. Frm1 has a button whose click event
calls frm2 -- frm2.ShowDialog(). Frm2 has a button that calls frm3 --
frm3.ShowDialog(). When I minimize frm3, I want the other two forms to
minimize as well. As I have it now, frm3 minimizes and a small title bar
appears at the lower left of my desktop, and frm2 and frm1 remain in the
center and I cannot touch them because of ShowDialog. (I don't want to use
Show.) How do I get all three forms to minimize?

Thanks,
Nathan
 
Hi Nathan,

I think with a lot of code. Why not just delete the minimizebox from your
dialogform, no user sees it (it is a dialog, show it is normal that you
cannot minimize it) and the problem is gone.

I hope this helps?

Cor
 
* "Cor said:
I think with a lot of code. Why not just delete the minimizebox from your
dialogform, no user sees it (it is a dialog, show it is normal that you
cannot minimize it) and the problem is gone.

LOL -- But that won't allow the user to minimize the app at all...
 
Only from the forms that he start with
frmx.showdialog

The others stays, I think this is quit normal.
 
* "Cor said:
Only from the forms that he start with
frmx.showdialog

The others stays, I think this is quit normal.

OK... Somtimes it would be nice to minimze the whole app, even if modal
dialogs are shown. For example, if the program is showing a modal
progress dialog.
 
You can do that with showdialog?
OK... Somtimes it would be nice to minimze the whole app, even if modal
dialogs are shown. For example, if the program is showing a modal
progress dialog.
(And I mean than not with a bunch of code what can be easier done with show)
 
To be a little more specific, frm1 is the main form, frm3 is a data entry
form, and frm 2 is the form where the user chooses which part of the
database is to be edited. The reason I've done ShowDialog is because I only
want one process going at one time. What I want should be possible; I've
seen it done with other programs. AVG Antivirus, for instance, when
scanning shows a modal progress dialog, as Herfried mentioned, which, when
minimized, minimizes the whole application.

Besides, even with .Show I can only see how to minimize each of the forms
individually, not all at once.
 
Hi Nathan,

Here a part of code you can use for what you ask.
But it is absolute not complete,

I hope you succeed?

Cor

\\\
Private WithEvents frm As Form
Private frmOpen As Boolean

Private Sub frm_VisibleChanged(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles frm.VisibleChanged
If frmOpen Then
If frm.WindowState = FormWindowState.Minimized Then
Me.WindowState = FormWindowState.Minimized
Else
Me.WindowState = FormWindowState.Normal
End If
End If
End Sub

Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
frm = New Form2
frm.ShowDialog()
frmOpen = True
End Sub
///
 
Cor,

Thanks for the code. I thought I might have to do something like this, but
I was hoping there was an "easier" way. I didn't know exactly how to do it,
though, so I'm glad for your input.

Just a thought--if a modal form is minimized, you can't access the other
form(s). What then is the purpose in them still showing? I would think
they would minimize as well by default?
 
* "Cor said:
You can do that with showdialog?

I don't think so. Maybe there is a way, other apps like WinSCP provide
this feature too (but it's AFAIR written in Delphi).
 
Hi Herfried,

I made it, see the sample, it was less work than I thouht, I had to think at
that procedure I use to show and close 3 forms (another procedure than you
use). With that it was easy.

Look at it it is in this tread, basicly simple but I think some work to be
sure it is all synchronizes.

Cor
 
* "Cor said:
I made it, see the sample, it was less work than I thouht, I had to think at
that procedure I use to show and close 3 forms (another procedure than you
use). With that it was easy.

Look at it it is in this tread, basicly simple but I think some work to be
sure it is all synchronizes.

Nice code!!!
 
Hi Cor,

I tried your code and couldn't get it to work. The frm.VisibleChanged only
runs when the form is opened and closed. So I tried frm.SizeChanged, which
runs on opening and minimizing. I put your code in there (tried with and
without checking the boolean value), and when I minimize the second form it
closes, and the first form minimizes. A Msgbox tells me the WindowState of
both forms is Minimized, but the second form has closed altogether. Where
to go from here?
 
Hi Nathan,

It is just a sample,

Therefore you have to do it first as a sample and as I wrote it is not
complete.

You have to open a project with2 forms, a button on form1 and than paste the
code in form1.
Then you can start your project
push on button 1 on form1 (you have to leave form1 in normal state)
Form 2 opens,
When you minimize that you will see that form1 minimize also,
When you opens form2 again, form1 will open also.

But the rest you have to do yourself, (maximize state, opens form2 when the
minimize from form1 is openend again etc etc)

I said you have a lot to synchronize in my opinon, therefore my first answer
I gave to you.

Cor
 
Back
Top