Added titles to hotkey info label

This commit is contained in:
Jaex 2020-09-21 12:00:32 +03:00
parent 9a92490f91
commit f4f29f911a
2 changed files with 9 additions and 1 deletions

View File

@ -337,5 +337,12 @@ namespace ShareX.HelpersLib
{
return text.FromBase(from, digits).ToBase(to, digits);
}
public static string PadCenter(this string str, int totalWidth, char paddingChar = ' ')
{
int padding = totalWidth - str.Length;
int padLeft = (padding / 2) + str.Length;
return str.PadLeft(padLeft, paddingChar).PadRight(totalWidth, paddingChar);
}
}
}

View File

@ -455,7 +455,8 @@ namespace ShareX
int maxHotkeyLength = hotkeys.Max(x => x.HotkeyInfo.ToString().Length);
int maxDescriptionLength = hotkeys.Max(x => x.TaskSettings.ToString().Length);
sb.AppendFormat("┌{0}┬{1}┐\r\n", new string('─', maxHotkeyLength + 2), new string('─', maxDescriptionLength + 2));
// TODO: Translate
sb.AppendFormat("┌{0}┬{1}┐\r\n", "Hotkey".PadCenter(maxHotkeyLength + 2, '─'), "Description".PadCenter(maxDescriptionLength + 2, '─'));
for (int i = 0; i < hotkeys.Count; i++)
{