Author: ivanz Date: 2008-02-20 06:15:20 -0500 (Wed, 20 Feb 2008) New Revision: 96234
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs Log: 2008-02-20 Ivan N. Zlatev <[EMAIL PROTECTED]> * PropertyGridView.cs: - Fix a NRE that caused a test failure - Another performance improvement - cache the standard values listbox. Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-02-20 11:02:56 UTC (rev 96233) +++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-02-20 11:15:20 UTC (rev 96234) @@ -1,3 +1,10 @@ +2008-02-20 Ivan N. Zlatev <[EMAIL PROTECTED]> + + * PropertyGridView.cs: + - Fix a NRE that caused a test failure + - Another performance improvement - cache the standard values + listbox. + 2008-02-19 Jonathan Pobst <[EMAIL PROTECTED]> * ComboBox.cs: Fix previous change to affect both 1.1 and 2.0 Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs =================================================================== --- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs 2008-02-20 11:02:56 UTC (rev 96233) +++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs 2008-02-20 11:15:20 UTC (rev 96234) @@ -58,6 +58,7 @@ private StringFormat string_format; private Font bold_font; private Brush inactive_text_brush; + private ListBox dropdown_list; #endregion #region Contructors @@ -756,23 +757,25 @@ else { ICollection std_values = entry.AcceptedValues; if (std_values != null) { - ListBox listBox = new ListBox (); - listBox.BorderStyle = BorderStyle.FixedSingle; + if (dropdown_list == null) + dropdown_list = new ListBox (); + dropdown_list.Items.Clear (); + dropdown_list.BorderStyle = BorderStyle.FixedSingle; int selected_index = 0; int i = 0; foreach (object obj in std_values) { - listBox.Items.Add (obj); + dropdown_list.Items.Add (obj); if (entry.ValueText != null && entry.ValueText.Equals (obj)) selected_index = i; i++; } - listBox.Height = row_height * Math.Min (listBox.Items.Count, 15); - listBox.Width = ClientRectangle.Width - SplitterLocation - (vbar.Visible ? vbar.Width : 0); - listBox.KeyDown += new KeyEventHandler (listBox_KeyDown); - listBox.MouseUp+=new MouseEventHandler (listBox_MouseUp); + dropdown_list.Height = row_height * Math.Min (dropdown_list.Items.Count, 15); + dropdown_list.Width = ClientRectangle.Width - SplitterLocation - (vbar.Visible ? vbar.Width : 0); + dropdown_list.KeyDown += new KeyEventHandler (listBox_KeyDown); + dropdown_list.MouseUp+=new MouseEventHandler (listBox_MouseUp); if (std_values.Count > 0) - listBox.SelectedIndex = selected_index; - DropDownControl (listBox); + dropdown_list.SelectedIndex = selected_index; + DropDownControl (dropdown_list); } } } @@ -842,6 +845,8 @@ private void UpdateGridTextBoxBounds (GridEntry entry) { + if (entry == null) + return; int y = -vbar.Value*row_height; CalculateItemY (entry, property_grid.RootGridItem.GridItems, ref y); int x = SplitterLocation + ENTRY_SPACING + (entry.PaintValueSupported ? VALUE_PAINT_INDENT : 0); _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches