F2023-048: Beaver Valley long attachment section numbers overwrite section text in the editor

This commit is contained in:
Kathy Ruffing 2023-05-11 16:00:18 +00:00
parent 69fec106f7
commit 9c9495f4ff

View File

@ -165,13 +165,16 @@ namespace Volian.Controls.Library
if (!MyItemInfo.IsProcedure) lblTab.Text = tabString; // B2021-068: don't reset if procedure (it is blank when initialized)
// calculate the width based upon characters per inch considering user's DPI
int cpi = MyItemInfo.IsStep ? (int)MyItemInfo.FormatStepData.TabData.Font.CPI : 12;
// F2023-048: Attachment text overwriting Attachment number. (Changed to 11 from 12) - note this
// was reported for Beaver Valley but could happen for any long section numbers
int cpi = MyItemInfo.IsStep ? (int)MyItemInfo.FormatStepData.TabData.Font.CPI : 11;
// if the tab ends with a single digit & has a '.' before it, add space for the possibility
// that the number can be two digits, for example... 8.1.9 goes to 8.1.10. We want
// the step windows to line up, so the 8.1.9 has one character more space (lastDigitSingle)
// F2023-048: Attachment text overwriting Attachment number, only add 1 to label width if is a step tab
bool lastDigitSingle = Regex.IsMatch(tabString, "^.*[^0-9][0-9] *$");
lblTab.Width = ((lastDigitSingle ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi;
lblTab.Width = ((lastDigitSingle && MyItemInfo.IsStep ? 1 : 0) + tabString.Length) * MyStepPanel.DPI / cpi;
Invalidate();
//if (MyItemInfo.MyTab.Offset == 0) // commented out for Farley bug fix B2015-123 alignment of tabs on the edit screen (Farly is only one using tab offset)
{