![]() |
Click here to advertise with us
|
|
|||||||
| Windows Forms Discussion related to Winforms application development |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
In several forms I use an event handler for the resize event. When a particular form is minimized, I need to do a quick clean up of related forms, also displayed, to clear the screen. When the same form is then maximized, I run a process to restore those related forms. I've noticed that 'some' of the (maximize) resize events get called twice (sequentially) by the system's "external code" and others do not. This runs my restoration code twice and is a bit distracting for the user. The various forms are almost identical in their properties and code layout and yet some get maximized twice. Are there any insights out there on what causes these resize events to pop up sequentially like that and is there any way to prevent it?
Code:
Private Sub Me_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
' "Me" is a mostly transparent form overlying the main form "Frm"
If Me.WindowState <> FormWindowState.Minimized And Frm IsNot Nothing Then
Frm.Show() ' This is the main underlying form.
RefreshPages() ' This is my restoration process for other related forms.
End If
End Sub
|
|
||||
|
Why don't you use the Owner forms feature? Makes owned forms minimize/restore/close and overlay with the owner automatically.
Of curiosity I also checked Resize event when maximizing a form, and it does happen twice, but only once for WindowState Maximized. If you need to know that a regular resize event is not followed by a maximized/minimize/restore resize event you can use the ResizeBegin and ResizeEnd events, they don't occur for min/max/restore.
__________________
Some useful links: Learning videoes, Code Samples, WMI Code Creator, MSDN, The Code Project, WindowsClient.net, ASP.net, W3 Schools, Regular-Expressions.info, GDI+ FAQ
How to format posts with code blocks etc - present the problem/post properly ![]() |
|
|||
|
I seem to have problems controling the "z-order" of forms when I use the "Owner" and "Owned" forms properties. Invariably, the form I need on top is hidden below all other forms and the ones I need in between are in the wrong order when the screen is restored. Of course I can use the "Topmost" property for the top form but that doesn't help with the intermediate forms and sits on top of any other apps that get restored without minimizing my app.
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|