Author: ivanz Date: 2008-02-19 15:03:01 -0500 (Tue, 19 Feb 2008) New Revision: 96182
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/PropertyGridView.cs Log: 2008-02-19 Ivan N. Zlatev <[EMAIL PROTECTED]> [Backport to 1.9] * PropertyGridView.cs: Fix a big performance bug. 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-19 20:01:42 UTC (rev 96181) +++ branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog 2008-02-19 20:03:01 UTC (rev 96182) @@ -1,3 +1,8 @@ +2008-02-19 Ivan N. Zlatev <[EMAIL PROTECTED]> + + [Backport to 1.9] + * PropertyGridView.cs: Fix a big performance bug. + 2008-02-17 Ivan N. Zlatev <[EMAIL PROTECTED]> [Backport to 1.9] Modified: branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs =================================================================== --- branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs 2008-02-19 20:01:42 UTC (rev 96181) +++ branches/mono-1-9/mcs/class/Managed.Windows.Forms/System.Windows.Forms/PropertyGridView.cs 2008-02-19 20:03:01 UTC (rev 96182) @@ -560,19 +560,20 @@ vbar.Value = 0; vbar.Visible = false; } + UpdateGridTextBoxBounds ((GridEntry)property_grid.SelectedGridItem); } - private bool GetScrollBarVisible () - { - if (property_grid.RootGridItem == null) - return false; - - int visibleRows = GetVisibleRowsCount (); - int openedItems = GetVisibleItemsCount ((GridEntry)property_grid.RootGridItem); - if (openedItems > visibleRows) - return true; - return false; - } + // private bool GetScrollBarVisible () + // { + // if (property_grid.RootGridItem == null) + // return false; + // + // int visibleRows = GetVisibleRowsCount (); + // int openedItems = GetVisibleItemsCount ((GridEntry)property_grid.RootGridItem); + // if (openedItems > visibleRows) + // return true; + // return false; + // } #region Drawing Code private void DrawGridItems (GridItemCollection grid_items, PaintEventArgs pevent, int depth, ref int yLoc) { @@ -829,13 +830,7 @@ grid_textbox.ForeColor = SystemColors.ControlText; grid_textbox.ReadOnly = !entry.IsEditable; } - - 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); - grid_textbox.SetBounds (x + ENTRY_SPACING, y + ENTRY_SPACING, - ClientRectangle.Width - ENTRY_SPACING - x - (GetScrollBarVisible () ? vbar.Width : 0), - row_height - ENTRY_SPACING); + UpdateGridTextBoxBounds (entry); grid_textbox.Text = entry.IsMerged && !entry.HasMergedValue ? String.Empty : entry.ValueText; grid_textbox.Visible = true; InvalidateItem (entry); @@ -845,6 +840,16 @@ } } + private void UpdateGridTextBoxBounds (GridEntry entry) + { + 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); + grid_textbox.SetBounds (x + ENTRY_SPACING, y + ENTRY_SPACING, + ClientRectangle.Width - ENTRY_SPACING - x - (vbar.Visible ? vbar.Width : 0), + row_height - ENTRY_SPACING); + } + // Calculates the sum of the heights of all items before the one // private bool CalculateItemY (GridEntry entry, GridItemCollection items, ref int y) _______________________________________________ Mono-patches maillist - Mono-patches@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-patches