B2022-137 Table (grid) performance improvements.

B2022-137 added method to get font size from RTF string (used for tables)
B2022-137 Table (grid) performance improvements getting font sizes
B2022-137 Table (grid) performance improvements showing table cell shading
This commit is contained in:
2023-03-31 17:43:11 +00:00
parent 8d2dc00ad5
commit d11cba261f
4 changed files with 23 additions and 36 deletions

View File

@@ -2636,41 +2636,10 @@ namespace Volian.Controls.Library
// Selected table cell is not in edit mode. Go into edit mode and position according
// to the pass in selOpt.
// B2021-090 don't try to get the font size on an RO table
// B2022-137 Table performance improvements
if (MyFlexGrid != null && MyFlexGrid.Editor == null && !MyFlexGrid.IsRoTable)
{
float fntSz = 0;
C1.Win.C1FlexGrid.CellRange cr = MyFlexGrid.Selection; // get the selected grid cell range
for (int r = cr.r1; r <= cr.r2; r++)
for (int c = cr.c1; c <= cr.c2; c++)
{
if (rtnFontSize == 0) continue;
MyFlexGrid._GettingFontSize = true;
MyFlexGrid.Select(r, c);
MyFlexGrid.StartEditing();
switch (selOpt)
{
case SelectionOption.Start:
MyStepRTB.Select(0, 0);
break;
case SelectionOption.All:
MyStepRTB.SelectAll();
break;
case SelectionOption.End:
MyStepRTB.Select(MyStepRTB.TextLength, 0);
break;
default:
MyStepRTB.Select(0, 0);
break;
}
fntSz = MyStepRTB.GetRTFFontSize(); // returns 0 when there are mulitiple font sizes
if (rtnFontSize == -1)
rtnFontSize = fntSz; // first time getting font size in the foreach loop
else if (fntSz == 0 || fntSz != rtnFontSize)
rtnFontSize = 0; // indicates multiple font sizes in the selection
}
MyFlexGrid.Select(cr);
MyFlexGrid.Focus();
MyFlexGrid._GettingFontSize = false; // _GettingFontSize prevents the cell text editor from flashing on/off when getting font size
rtnFontSize = StepRTB.GetRTFFontSize(MyFlexGrid.Selection.Clip);
}
else
rtnFontSize = MyStepRTB.GetRTFFontSize(); // returns 0 when there are mulitiple font sizes