[Mono-bugs] [Bug 79442][Nor] New - Overriding Control.CreateParams to get a 2 pixel 3D border in the Non-Client area doesn't work

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Sep 19 09:52:29 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=79442

--- shadow/79442	2006-09-19 09:52:29.000000000 -0400
+++ shadow/79442.tmp.6253	2006-09-19 09:52:29.000000000 -0400
@@ -0,0 +1,68 @@
+Bug#: 79442
+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: Overriding Control.CreateParams to get a 2 pixel 3D border in the Non-Client area doesn't work
+
+The following code allows it to create a 2 pixel 3D border in the
+Non-Client area of an overriden Control on windows (Linux, no border is
+visible).
+
+Attached is also a windows/linux screenshot that shows the difference.
+
+using System;
+using System.Drawing;
+using System.Windows.Forms;
+
+namespace NonClientBorder
+{
+	public class MainForm : Form
+	{
+		public MainForm ()
+		{
+			TestControl tc = new TestControl ();
+			tc.Location = new Point (10, 10);
+			tc.Size = new Size (100, 100);
+			tc.BackColor = Color.LightBlue;
+
+			Controls.Add (tc);
+		}
+
+		[STAThread]
+		static void Main() 
+		{
+			Application.Run(new MainForm());
+		}
+	}
+
+	public class TestControl : Control
+	{
+		protected override CreateParams CreateParams
+          	{
+			get {
+				CreateParams cparams;
+
+				cparams = base.CreateParams;
+
+				cparams.ExStyle &= ~512;
+				cparams.Style &= ~8388608 /*WS_BORDER*/;
+				cparams.ExStyle = cparams.ExStyle | 512 /*WS_EX_DLGFRAME*/;
+
+				return cparams;
+			}
+
+		}
+	}
+}


More information about the mono-bugs mailing list