Thanks Lalit for answering my post.
Unfortunately, there is no class MDIChild (as far as I know..). There is a
unheritable class MDIClient (the house of the MDIChildren collection,
MDIChildren are forms).
AfaIk, the effect of flickering is actually caused by the MDIClient which is
opening the form (its MDIChild).
I solved this by using the tip from Shawn Burke , mentionned by George
Shepherd (
www.syncfusion.com):
I stop the MDIform from painting for a very small moment while the child
form is showing itself. The code is as follows:
Dim frm As New Form 'this may be a specific subclass instead of a generic
one...)
'Make it borderless
frm.FormBorderStyle = FormBorderStyle.None
'make it a child of self
frm.MdiParent = Me
'don't maximize, but fill ! this avoids the maximize/minimize box
frm.Dock = DockStyle.Fill
'Populate the form with the controls you want (if it generic)
frm.Controls.Add(....)
'perform the init and show the form (freeze painting of the MDIForm while
doing this to avoid an ugly flickering)
SendMessage(Handle, WM_SETREDRAW, 0, 0)
'have the form showing itself (this is not the actual code)
'frm.show
'This forces the fill, because the form doesn't dock.fill automatically
'I found that the form is not filling the full client area, the trick below
does the job...
'(The MDIForm has a statusbar, of course!)
StatusBar1.Height += 1
StatusBar1.Height -= 1
'Release the freeze of the MDIForm
SendMessage(Handle, WM_SETREDRAW, 1, 0)
'Force a re-draw of self (i.e. the MDIForm)
Invalidate(True)
'Reset the cursor, it has been set before (not shown)
Cursor = Cursors.Default
I hope this helps a few others who are wrestling with the same problem....
Roland
[quoted text, click to view] "Lalit" <lalits@bsil.com> wrote in message
news:exPjw5mxFHA.3856@tk2msftngp13.phx.gbl...
> Just overide MDIChild OncreateControl
>
> Protected Overrides Sub OnCreateControl()
>
> Me.FormBorderStyle = FormBorderStyle.None
>
> End Sub
>
> Lalit
>
> "Roland" <roland.demeester@skynet.be> wrote in mes
>
> sage news:ODgkY9bpFHA.736@tk2msftngp13.phx.gbl...
>>I am designing a MDI Application with the MIDChildren all maximized. I
>>create de (child)forms with a borderstyle.none, dockingstyle.fill and make
>>them a MDIChild before I show them. This works OK, except that when the
>>forms are created, they show up in the client area of the MDIform, not
>>maximized, with a caption, very shortly, before they are finaaly filling
>>the client area. In other words, there is a short flicker when a new form
>>is created and displayed. This process is most noticeable with a
>>not-so-powerful PC (or is it a not-so-fast-display-card?). This phenomenon
>>has been reported on several occasions in the newsgroups, but a cure has
>>never been offered. I did some research and subclassed the MdiClient,
>>overriding the WndProc message and filtering the message WM_NCPAINT and
>>174 (not that I ever saw this message). This is a suggestion of Andrzej
>>Markowski in the CodeProject, but I didn't see any effects. Has anybody
>>found a solution for this annoying behavior or an idea how to tackle this?
>>Thanks in advance!
>>
>
>