[Mono-bugs] [Bug 78080][Nor] Changed - DockStyle.Fill + BringToFront wrong behavior

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue May 16 03:42:50 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by atsushi at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=78080

--- shadow/78080	2006-05-09 16:55:02.000000000 -0400
+++ shadow/78080.tmp.5738	2006-05-16 03:42:50.000000000 -0400
@@ -10,13 +10,13 @@
 Component: Windows.Forms
 AssignedTo: peter at novonyx.com                            
 ReportedBy: roger.jakobsson at jorosoft.se               
 QAContact: mono-bugs at ximian.com
 TargetMilestone: ---
 URL: 
-Summary: UserControl, BringToFront wrong behavior
+Summary: DockStyle.Fill + BringToFront wrong behavior
 
 Description of Problem:
 When using BringToFront on a UserControl in a Panel, the z-order doesn't 
 work correctly
 
 Steps to reproduce the problem:
@@ -36,6 +36,69 @@
 Always
 
 ------- Additional Comments From roger.jakobsson at jorosoft.se  2006-04-11 17:07 -------
 Created an attachment (id=16750)
 Sample to reproduce problem
 
+
+------- Additional Comments From atsushi at ximian.com  2006-05-16 03:42 -------
+It is nothing to do with UserControl. It looks rather DockStyle.Fill
+and BringToFront() matter.
+
+Minimized repro code:
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+public class Form1 : Form
+{
+        Button button1;
+        Button button2;
+        System.Windows.Forms.Panel panel1;
+        Label f1;
+        Label f2;
+
+        static void Main()
+        {
+                Application.Run(new Form1());
+        }
+
+        public Form1()
+        {
+                button1 = new Button();
+                button2 = new Button();
+                panel1 = new Panel();
+                panel1.Dock = DockStyle.Top;
+                button1.Location = new Point(32, 8);
+                button1.Text = "Load page 1";
+                button1.Click += new EventHandler(this.button1_Click);
+                button2.Location = new Point(160, 8);
+                button2.Text = "Load page 2";
+                button2.Click += new EventHandler(this.button2_Click);
+                Controls.Add(this.button1);
+                Controls.Add(this.button2);
+                Controls.Add(this.panel1);
+
+                f1 = new Label();
+                f1.Text = "Panel 1";
+                f1.Dock = DockStyle.Fill;
+                Controls.Add(f1);
+                f2 = new Label();
+                f2.Text = "Panel 2";
+                f2.Dock = DockStyle.Fill;
+                Controls.Add(f2);
+        }
+
+        void button1_Click(object sender, System.EventArgs e)
+        {
+                f1.BringToFront();
+        }
+
+        void button2_Click(object sender, System.EventArgs e)
+        {
+                f2.BringToFront();
+        }
+}
+
+Comment out f1.Dock = DockStyle.Fill (or f2) and it will work (control
+will be hidden, but keyboard control is still possible).


More information about the mono-bugs mailing list