[Mono-bugs] [Bug 79378][Nor] New - Prevent a user from moving a form during runtime doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Sep 12 05:24:00 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 alex.olk at googlemail.com.

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

--- shadow/79378	2006-09-12 05:24:00.000000000 -0400
+++ shadow/79378.tmp.17594	2006-09-12 05:24:00.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 79378
+Product: Mono: Class Libraries
+Version: 1.0
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: alex.olk at googlemail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Prevent a user from moving a form during runtime doesn't work
+
+Trying to prevent a user from moving a form during runtime with an
+overriden WndProc doesn't work. The form can still be moved.
+
+Test case:
+
+using System;
+using System.Windows.Forms;
+
+namespace WinDontMove
+{
+	public class MainForm : Form
+	{
+		protected override void WndProc( ref Message m ) 
+		{ 
+			const int WM_NCLBUTTONDOWN = 161; 
+			const int WM_SYSCOMMAND = 274; 
+			const int HTCAPTION = 2; 
+			const int SC_MOVE = 61456; 
+
+			if ( (m.Msg == WM_SYSCOMMAND) && (m.WParam.ToInt32() == SC_MOVE) ) 
+				return; 
+			if ( (m.Msg == WM_NCLBUTTONDOWN) && (m.WParam.ToInt32() == HTCAPTION) ) 
+				return; 
+
+			base.WndProc( ref m ); 
+		}  
+
+		[STAThread]
+		static void Main() 
+		{
+			Application.Run(new MainForm());
+		}
+	}
+}
+
+Found at Windows Forms FAQ forums.


More information about the mono-bugs mailing list