Forms flash

  • Thread starter Thread starter Tim Latham
  • Start date Start date
T

Tim Latham

I'm creating forms dynamically and their contained controls
programmatically,
rather than using the Form editor - using Controls.Add(Control).

Some forms created in this way cause the form underneath it to flash
(presumably refresh) when another form is closed. It happens
regardless of the screen position of the upper form. With some forms
it does not happen.

Does anyone know what causes this or what would solve it?
 
Tim Latham said:
I'm creating forms dynamically and their contained controls
programmatically,
rather than using the Form editor - using Controls.Add(Control).

Some forms created in this way cause the form underneath it to flash
(presumably refresh) when another form is closed. It happens
regardless of the screen position of the upper form. With some forms
it does not happen.

Does anyone know what causes this or what would solve it?

If I remember it's caused by closing a form by setting Visible to false, or
by calling Close(). Forms should (bizarrely in my opinion) be closed by
assigning the DialogResult property.

Stu
 
Tim Latham said:
I'm creating forms dynamically and their contained controls
programmatically,
rather than using the Form editor - using Controls.Add(Control).

Some forms created in this way cause the form underneath it to flash
(presumably refresh) when another form is closed. It happens
regardless of the screen position of the upper form. With some forms
it does not happen.

This is not caused by adding your controly dynamically because that's what
the forms designer is doing too... I feel sorry, but I don't know the
reason for the flashing ;-).
 
Make sure that there is nothing in the logic of your code that causes the
flashing forms to be loaded more than once. That would give appearence of
flashing. Another thing that might work would be suspending layout similar to
how the framework does when it generates code.
 
Stu said:
If I remember it's caused by closing a form by setting Visible to false, or
by calling Close(). Forms should (bizarrely in my opinion) be closed by
assigning the DialogResult property.

Stu
 
Back
Top