Author: jpobst
Date: 2008-02-05 09:52:36 -0500 (Tue, 05 Feb 2008)
New Revision: 94887
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
Log:
2008-02-01 Jonathan Pobst <[EMAIL PROTECTED]>
[Backport to 1.9]
* Control.cs: Remove HeightInternal.
* ListBox.cs: Commit patch from James Purcell that correctly
calculates heights for ListBoxen.
[Fixes bug #357152]
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
---
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-05 14:48:01 UTC (rev 94886)
+++
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2008-02-05 14:52:36 UTC (rev 94887)
@@ -1,5 +1,12 @@
2008-02-01 Jonathan Pobst <[EMAIL PROTECTED]>
[Backport to 1.9]
+ * Control.cs: Remove HeightInternal.
+ * ListBox.cs: Commit patch from James Purcell that correctly
+ calculates heights for ListBoxen.
+ [Fixes bug #357152]
+
+2008-02-01 Jonathan Pobst <[EMAIL PROTECTED]>
+ [Backport to 1.9]
* Label.cs: Apply patch from James Purcell that corrects the
signature of the AutoSize property.
[Fixes bug #357605]
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
===================================================================
---
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2008-02-05 14:48:01 UTC (rev 94886)
+++
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Control.cs
2008-02-05 14:52:36 UTC (rev 94887)
@@ -2856,11 +2856,6 @@
[Browsable(false)]
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
public int Height {
- get { return HeightInternal; }
- set { HeightInternal = value; }
- }
-
- internal virtual int HeightInternal {
get { return this.bounds.Height; }
set { SetBounds(bounds.X, bounds.Y, bounds.Width,
value, BoundsSpecified.Height); }
}
Modified:
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
===================================================================
---
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2008-02-05 14:48:01 UTC (rev 94886)
+++
branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ListBox.cs
2008-02-05 14:52:36 UTC (rev 94887)
@@ -70,7 +70,7 @@
Hashtable item_heights;
private int item_height = -1;
private int column_width = 0;
- private int requested_height = -1;
+ private int requested_height;
private DrawMode draw_mode = DrawMode.Normal;
private int horizontal_extent = 0;
private bool horizontal_scrollbar = false;
@@ -105,6 +105,7 @@
public ListBox ()
{
+ requested_height = bounds.Height;
InternalBorderStyle = BorderStyle.Fixed3D;
BackColor = ThemeEngine.Current.ColorWindow;
@@ -983,6 +984,10 @@
protected override void OnHandleCreated (EventArgs e)
{
base.OnHandleCreated (e);
+
+ if (IntegralHeight)
+ UpdateListBoxBounds ();
+
LayoutListBox ();
}
@@ -1069,30 +1074,38 @@
SetBounds (new_bounds.X, new_bounds.Y,
new_bounds.Width, new_bounds.Height, specified);
}
#endif
+
+ private int SnapHeightToIntegral (int height)
+ {
+ int border;
+
+ switch (border_style) {
+ case BorderStyle.Fixed3D:
+ border =
ThemeEngine.Current.Border3DSize.Height;
+ break;
+ case BorderStyle.FixedSingle:
+ border = ThemeEngine.Current.BorderSize.Height;
+ break;
+ case BorderStyle.None:
+ default:
+ border = 0;
+ break;
+ }
+
+ height -= (2 * border);
+ height -= height % ItemHeight;
+ height += (2 * border);
+
+ return height;
+ }
protected override void SetBoundsCore (int x, int y, int
width, int height, BoundsSpecified specified)
{
if ((specified & BoundsSpecified.Height) ==
BoundsSpecified.Height)
requested_height = height;
- if (IntegralHeight) {
- int border;
- switch (border_style) {
- case BorderStyle.Fixed3D:
- border =
ThemeEngine.Current.Border3DSize.Height;
- break;
- case BorderStyle.FixedSingle:
- border =
ThemeEngine.Current.BorderSize.Height;
- break;
- case BorderStyle.None:
- default:
- border = 0;
- break;
- }
- height -= (2 * border);
- height -= height % ItemHeight;
- height += (2 * border);
- }
+ if (IntegralHeight && IsHandleCreated)
+ height = SnapHeightToIntegral (height);
base.SetBoundsCore (x, y, width, height, specified);
UpdateScrollBars ();
@@ -1311,19 +1324,6 @@
return item_rect;
}
- internal override int HeightInternal {
- get {
- if (requested_height > -1)
- return requested_height;
- else
- return bounds.Height;
- }
- set {
- base.HeightInternal = value;
- requested_height = value;
- }
- }
-
// Value Changed
private void HorizontalScrollEvent (object sender, EventArgs e)
{
@@ -2067,10 +2067,8 @@
private void UpdateListBoxBounds ()
{
- if (requested_height == -1)
- return;
-
- SetBounds(bounds.X, bounds.Y, bounds.Width,
requested_height, BoundsSpecified.None);
+ if (IsHandleCreated)
+ SetBounds (bounds.X, bounds.Y, bounds.Width,
IntegralHeight ? SnapHeightToIntegral (requested_height) : requested_height,
BoundsSpecified.None);
}
private void UpdateScrollBars ()
@@ -2812,3 +2810,4 @@
}
}
+
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches