[Mono-bugs] [Bug 565944] Control.Invalidate(true) does not call invalidate on nested controls
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Thu Jan 7 07:41:06 EST 2010
http://bugzilla.novell.com/show_bug.cgi?id=565944
http://bugzilla.novell.com/show_bug.cgi?id=565944#c2
Carlos Alberto Cortez <calberto.cortez at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |calberto.cortez at gmail.com
--- Comment #2 from Carlos Alberto Cortez <calberto.cortez at gmail.com> 2010-01-07 12:41:02 UTC ---
Actually calling Invalidate on a MdiContainer is not generating Invalidated
events for the children in the Mdi children, as the next sample shows:
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
public class Test
{
static void Main (string [] args)
{
Application.EnableVisualStyles ();
TestForm form = new TestForm ();
form.ShowDialog ();
}
}
public class TestForm : Form
{
Form mdi_form;
Control c;
Control c2;
bool invalidated_called;
public TestForm ()
{
IsMdiContainer = true;
mdi_form = new Form ();
mdi_form.Text = "Child form";
mdi_form.MdiParent = this;
c = new Button ();
c.Text = "Invalidate";
c.Click += delegate
{
invalidated_called = false;
Refresh ();
Console.WriteLine ("Invalidated reached = " +
invalidated_called);
};
c2 = new Label ();
c2.Text = "World";
c2.Location = new Point (50, 50);
c2.Invalidated += delegate
{
invalidated_called = true;
};
mdi_form.Controls.AddRange (new Control [] { c, c2 });
mdi_form.Show ();
}
}
Clicking on the "Invalidate" button should fire the Invalidated event on the
Label child, but it's not *at all*.
What happens in your sample, is that the call to Refresh (and not the call to
Invalidate) is somehow forcing the mdi container to wait for the paint of the
mdi children (and its controls) *because it's in the Show event*, and that's
exactly when *all* the controls are shown for the first time.
In other words: the difference in behaviour is not related to Invalidate, but
to Refresh _on an mdi container_ inside the Show event (if you call Refresh
outside the Show event, nothing happens at all). I don't think this small
difference is worth for a bug.
Hopefully the explanation was *not that* complicated ;-)
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
More information about the mono-bugs
mailing list