[Mono-bugs] [Bug 342363] New: Capture problems after another window has been focused

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Nov 16 13:50:24 EST 2007


https://bugzilla.novell.com/show_bug.cgi?id=342363

           Summary: Capture problems after another window has been focused
           Product: Mono: Class Libraries
           Version: unspecified
          Platform: Other
        OS/Version: All
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: Windows.Forms
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: derzhavinas at rambler.ru
         QAContact: mono-bugs at ximian.com
          Found By: ---


Description of Problem:
We have a 2 forms: MainForm and Form2. MainForm has a 2 child contols: green
panel and blue panel. Green panel has a capture and when the mouse cursor is
moving you can see it coordinates in the green panel. Try to get a focus to the
Form2 by left mouse button click, and than make a mouse move, you'll see, that
the mouse coordainates in green panel is freezing. It means, that the green
panel was lost self capture, even if the Capture property set to true.

Steps to reproduce the problem:

/// ********* E X A M P L E ********************
// project created on 16.11.2007 at 20:48
using System;
using System.Drawing;
using System.Windows.Forms;

namespace CaptureTest
{
        class MainClass
        {

                public static void Main(string[] args)
                {
                        Console.WriteLine("!!! Form.Capture ERROR example
!!!");

                        MainClass mc = new MainClass();
                        Application.Run(mc.MainForm);
                }


                Form _MainForm = null; //
                public Form MainForm { get {return _MainForm;} }
                Point _Location = new Point(-1, -1);


                public MainClass()
                {
                        /// create 2 form
                        _MainForm = new Form(); // one of this main
                        MainForm.Width=400;
                        MainForm.Height=400;
                        MainForm.Left=0;
                        MainForm.Top=0;
                        MainForm.Visible=true; // make it visble
                        //MainForm.MouseMove += new
MouseEventHandler(OnMouseMove);
                        //MainForm.Paint += new PaintEventHandler(OnPaint);

                        Panel panel = new Panel();
                        panel.BackColor = Color.LightGreen;
                        panel.Width=170;
                        panel.Height=100;
                        panel.Visible=true; // make it visible
                        panel.Left=100;
                        panel.Top=100;
                        MainForm.Controls.Add(panel);
                        panel.MouseMove += new MouseEventHandler(OnMouseMove);
                        panel.Paint += new PaintEventHandler(OnPaint);


                        Panel panel2 = new Panel();
                        panel2.BackColor = Color.LightBlue;
                        panel2.Width=170;
                        panel2.Height=100;
                        panel2.Visible=true; // make it visible
                        panel2.Left=200;
                        panel2.Top=100;
                        MainForm.Controls.Add(panel2);



                        /// the second form
                        Form Form2 = new Form();
                        Form2.Width=400;
                        Form2.Height=400;
                        Form2.Visible=true; // make it visible
                        Form2.Owner = MainForm;
                        Form2.Left=600;
                        Form2.Top=200;

                        /// make capture mouse for MainForm
                        panel.Capture = true;

                        Application.Run(MainForm);
                }


                /// <summary>
                /// Method for MainForm
                /// </summary>
                /// <param name="o">
                /// A <see cref="System.Object"/>
                /// </param>
                /// <param name="mea">
                /// A <see cref="MouseEventArgs"/>
                /// </param>
                void OnMouseMove(object o, MouseEventArgs mea)
                {
                        //MainForm.Capture = true;
                        _Location = mea.Location;
                        MainForm.Controls[0].Invalidate();
                }


                void OnPaint(object o, PaintEventArgs pea)
                {
                        Graphics g = pea.Graphics;
                        g.DrawString(_Location.ToString(), new Font("Aryal",
15), new SolidBrush(Color.DarkRed), MainForm.ClientRectangle);
                }
        }

}
// *********** E N D   O F   E X A M P L E *************

Actual Results:


Expected Results:


How often does this happen? 
Always

Additional Information:


-- 
Configure bugmail: https://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