Just to explain what's happening there...
1) The form's resize event is fired when the form is minimized by pressing Windows-D.
2) You have to create a new thread to restore the form as doing it in the same thread doesn't work.
3) A new thread is created which then creates an instance of a delegate, which is then invoked on the main thread, causing the window to be restored.
Hope that helps!
Main Topics
Browse All Topics





by: simoncampbellPosted on 2006-02-02 at 14:55:04ID: 15858231
To stop the form minimising, just set the form's MinimizeBox property to false, so that the mnimize button won't even show.
NewThread)
)
as for the other question, the resize event will fire when the form gets minimized by pressing Windows-D, so just add this code to your form:
Private Sub frmMain_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If WindowState = FormWindowState.Minimized Then
Dim t As New Threading.Thread(AddressOf
t.Start()
End If
End Sub
Delegate Sub dRestore()
Private Sub NewThread()
Dim r As New dRestore(AddressOf Restore)
Me.Invoke(r)
End Sub
Private Sub Restore()
Threading.Thread.Sleep(100
WindowState = FormWindowState.Normal
End Sub