Prevent Caption from Flickering with ShowModal?

  • Thread starter Thread starter Joe Keller
  • Start date Start date
J

Joe Keller

Hello,

I've got two forms in a sample project - Form1 and Form2. Form1 is a
standard CF form with the default VS.NET settings. Form2 is setup without
borders (FormBorderStyle = None) and a little smaller in height and width
than Form1. I am attempting to use Form2 as a modal, non-full-screen dialog
box and when I use the ShowModal() method from Form1 on Form2 (e.g.
Form2.ShowModal()) everything works fine *except* the caption on the parent
or background form (Form1) flickers many times over.

I want to prevent the background/parent form's caption from flickering -
I've tried overriding the OnPaint() and OnPaintBackground() methods of the
background/parent form to not repaint when Form2 is displayed but the
caption still flickers. It appears that Form2, because it is not full
screen, is trying to change the caption of Form1 several times over and
Form1 is preventing it from fully taking effect.

Has anyone run across this issue? Any workarounds?

Thanks,

Joe
 
This is a known issue. I just checked it in the SP2 beta and this behavior
is gone in SP2, so if you can afford to wait that would be worth it. SP2 is
expected to be available before the end of this year. A possible
workarounds that people have used with and without success is setting the
Visible property of the child (the dialog) to false temporarily.
 
Cool - I can wait. At what point in the process would I set the visible
property to false in the child dialog? Before the call to ShowDialog()?

Thanks,

Joe
 
In the child dialog you can try setting visible to false in the constructor
before the call to InitializeComponents and set it to true after this call.
 
Back
Top