[Mono-bugs] [Bug 77479][Nor] New - Form ClientRectangle.Size Ignores Menu and Scroll bar.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Feb 5 23:37:18 EST 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 kdaniels at usfamily.net.

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

--- shadow/77479	2006-02-05 23:37:18.000000000 -0500
+++ shadow/77479.tmp.30299	2006-02-05 23:37:18.000000000 -0500
@@ -0,0 +1,381 @@
+Bug#: 77479
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Fedora Core 3
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: kdaniels at usfamily.net               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Form ClientRectangle.Size Ignores Menu and Scroll bar.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+With .NET the ClientRectangle.Size does not subtract the Menu bar or the
+Scrollbar area of the form.
+
+The following program with a Menu and a Scroll bar can be used to
+illustrate the problem:
+
+using System;
+
+using System.Drawing;
+
+using System.Collections;
+
+using System.ComponentModel;
+
+using System.Windows.Forms;
+
+using System.Data;
+
+
+
+namespace WinScreenArea
+
+{
+
+	/// <summary>
+
+	/// Summary description for Form1.
+
+	/// </summary>
+
+	public class Form1 : System.Windows.Forms.Form
+
+	{
+
+		private System.Windows.Forms.MainMenu mainMenu1;
+
+		private System.Windows.Forms.MenuItem menuItem1;
+
+		private System.Windows.Forms.MenuItem menuItem2;
+
+		private System.Windows.Forms.MenuItem menuItem3;
+
+		private System.Windows.Forms.Label label1;
+
+		/// <summary>
+
+		/// Required designer variable.
+
+		/// </summary>
+
+		private System.ComponentModel.Container components = null;
+
+
+
+		public Form1()
+
+		{
+
+			//
+
+			// Required for Windows Form Designer support
+
+			//
+
+			InitializeComponent();
+
+
+
+			//
+
+			// TODO: Add any constructor code after InitializeComponent call
+
+			//
+
+		}
+
+
+
+		/// <summary>
+
+		/// Clean up any resources being used.
+
+		/// </summary>
+
+		protected override void Dispose( bool disposing )
+
+		{
+
+			if( disposing )
+
+			{
+
+				if (components != null) 
+
+				{
+
+					components.Dispose();
+
+				}
+
+			}
+
+			base.Dispose( disposing );
+
+		}
+
+
+
+		#region Windows Form Designer generated code
+
+		/// <summary>
+
+		/// Required method for Designer support - do not modify
+
+		/// the contents of this method with the code editor.
+
+		/// </summary>
+
+		private void InitializeComponent()
+
+		{
+
+			this.mainMenu1 = new System.Windows.Forms.MainMenu();
+
+			this.menuItem1 = new System.Windows.Forms.MenuItem();
+
+			this.menuItem2 = new System.Windows.Forms.MenuItem();
+
+			this.menuItem3 = new System.Windows.Forms.MenuItem();
+
+			this.label1 = new System.Windows.Forms.Label();
+
+			this.SuspendLayout();
+
+			// 
+
+			// mainMenu1
+
+			// 
+
+			this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+
+																					  this.menuItem1,
+
+																					  this.menuItem3});
+
+			// 
+
+			// menuItem1
+
+			// 
+
+			this.menuItem1.Index = 0;
+
+			this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
+
+																					  this.menuItem2});
+
+			this.menuItem1.Text = "Menu1";
+
+			// 
+
+			// menuItem2
+
+			// 
+
+			this.menuItem2.Index = 0;
+
+			this.menuItem2.Text = "MenuItem2";
+
+			// 
+
+			// menuItem3
+
+			// 
+
+			this.menuItem3.Index = 1;
+
+			this.menuItem3.Text = "Menu2";
+
+			// 
+
+			// label1
+
+			// 
+
+			this.label1.Location = new System.Drawing.Point(144, 288);
+
+			this.label1.Name = "label1";
+
+			this.label1.Size = new System.Drawing.Size(120, 23);
+
+			this.label1.TabIndex = 0;
+
+			this.label1.Text = "Label to force scollbar";
+
+			// 
+
+			// Form1
+
+			// 
+
+			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
+
+			this.AutoScroll = true;
+
+			this.ClientSize = new System.Drawing.Size(391, 294);
+
+			this.Controls.Add(this.label1);
+
+			this.Menu = this.mainMenu1;
+
+			this.Name = "Form1";
+
+			this.Text = "Form1";
+
+			this.MouseMove += new
+System.Windows.Forms.MouseEventHandler(this.Form1_MouseMove);
+
+			this.ResumeLayout(false);
+
+
+
+		}
+
+		#endregion
+
+
+
+		/// <summary>
+
+		/// The main entry point for the application.
+
+		/// </summary>
+
+		[STAThread]
+
+		static void Main() 
+
+		{
+
+			Application.Run(new Form1());
+
+		}
+
+		const int cursorMargin=50;
+
+		Cursor GetLocationCursor(int x,int y)
+
+		{
+
+			// returns the cursor type needed based on the location
+
+			// of the cursor. If the cursor is at least 50 pixels inside
+
+			// any edge of the ClientRectangle the desired cursor is
+
+			// the default cursor, otherwise it is one of the four
+
+			// arrow cursors.
+
+			int xMin,xMax,yMin,yMax;
+
+			xMin=this.ClientRectangle.Left+cursorMargin;
+
+			xMax=this.ClientRectangle.Right-cursorMargin;
+
+			yMin=this.ClientRectangle.Location.Y+cursorMargin;	// positive Y is down.
+
+			yMax=this.ClientRectangle.Size.Height-cursorMargin;
+
+			if (y<yMin)
+
+			{
+
+				return Cursors.IBeam;
+
+			}
+
+			else if(y>yMax)
+
+			{
+
+				return Cursors.IBeam;
+
+			}
+
+			if (x<=xMin)
+
+			{
+
+				return Cursors.IBeam;
+
+			}
+
+			else if(x>xMax)
+
+			{
+
+				return Cursors.IBeam;
+
+			}
+
+			return Cursors.Default;
+
+
+
+		}
+
+
+
+		private void Form1_MouseMove(object sender,
+System.Windows.Forms.MouseEventArgs e)
+
+		{
+
+			if (this.Cursor != Cursors.WaitCursor)
+
+			{
+
+				this.Cursor=GetLocationCursor(e.X,e.Y);
+
+			}
+
+		
+
+		}
+
+	}
+
+}
+
+
+
+Steps to reproduce the problem:
+1. Compile and execute the program.
+2. Using the Mouse, move the cursor around the screen. When you get within
+50 pixels of any border of the form the cursor will change to an IBeam.
+When you get to the end of the ClientRectangle area the cursor will change
+ back to an arrow. 
+
+With .Net this will happen if you cross the menu bar on the top, or the
+Scroll bar on the right of the form. With Mono the IBar remains to the end
+of the Form, ignoring the menu bar and the scroll bar.
+3. 
+
+Actual Results:
+Ibeam cursor does not change to an arrow when above the menu bar, or to the
+right of the scroll bar.
+
+Expected Results:
+Ibeam cursor should change to an Arrow when cursor is above the bottom of
+the menu bar, and to the right of the left most edge of the scroll bar.
+
+How often does this happen? 
+Always
+
+Additional Information:
+
+Mono is from SVN


More information about the mono-bugs mailing list