ソースを参照

2007-07-30 Jonathan Pobst <[email protected]>

	* TextBoxBase.cs: TextBoxBase reports itself at AutoSize, but doesn't
	actually do auto-sizing.  Override the internal GetPreferredSizeCore 
	so we can provide an implementation that returns the current width
	and preferred height.  Allows anchor = right to work with TextBox 2.0.
	[Fixes bug #82233]

svn path=/trunk/mcs/; revision=83032
Jonathan Pobst 18 年 前
コミット
85fa81286b

+ 8 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog

@@ -1,3 +1,11 @@
+2007-07-30  Jonathan Pobst  <[email protected]>
+
+	* TextBoxBase.cs: TextBoxBase reports itself at AutoSize, but doesn't
+	actually do auto-sizing.  Override the internal GetPreferredSizeCore 
+	so we can provide an implementation that returns the current width
+	and preferred height.  Allows anchor = right to work with TextBox 2.0.
+	[Fixes bug #82233]
+
 2007-07-30  Carlos Alberto Cortez <[email protected]>
 
 	* ListView.cs: Add support for navigating items in Groups mode, by

+ 9 - 0
mcs/class/Managed.Windows.Forms/System.Windows.Forms/TextBoxBase.cs

@@ -151,6 +151,8 @@ namespace System.Windows.Forms {
 			SetStyle(ControlStyles.UserPaint | ControlStyles.StandardClick, false);
 #if NET_2_0
 			SetStyle(ControlStyles.UseTextForAccessibility, false);
+			
+			base.SetAutoSizeMode (AutoSizeMode.GrowAndShrink);
 #endif
 
 			canvas_width = ClientSize.Width;
@@ -174,6 +176,13 @@ namespace System.Windows.Forms {
 			}
 		}
 
+#if NET_2_0
+		internal override Size GetPreferredSizeCore (Size proposedSize)
+		{
+			return new Size (Width, PreferredHeight);
+		}
+#endif
+
 		internal override void HandleClick(int clicks, MouseEventArgs me) {
 			// MS seems to fire the click event in spite of the styles they set
 			bool click_set = GetStyle (ControlStyles.StandardClick);