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

@@ -2716,6 +2716,22 @@ namespace Volian.Controls.Library
}
return (differentFonts || lastSZ == 0) ? 0 : lastSZ/2; // divide the RTF font size by two to get the font point size
}
// F2022-137 Table performance improvements
public static float GetRTFFontSize(string rtf)
{
MatchCollection mc = Regex.Matches(rtf, @"\\fs([0-9]+)");
bool differentFonts = false;
float lastSZ = 0;
foreach (Match match in mc)
{
float sz = float.Parse(match.Groups[1].Value);
if (lastSZ == 0)
lastSZ = sz;
else if (lastSZ != sz)
differentFonts = true;
}
return (differentFonts || lastSZ == 0) ? 0 : lastSZ / 2; // divide the RTF font size by two to get the font point size
}
private static Form ParentForm(Control ctrl)
{
while (!(ctrl.Parent is Form || ctrl.Parent is EditItem))