mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-25 20:52:44 +01:00
Added new method to Fix Large Font + Dispose Graphics after usage
This commit is contained in:
parent
0d5c196dd9
commit
1f425a99ea
@ -1105,7 +1105,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
int count = 0;
|
||||
for (int i = 0; i < words.Length; i++)
|
||||
{
|
||||
var regEx = new Regex("\\b" + words[i] + "\\b", (RegexOptions.CultureInvariant|RegexOptions.ExplicitCapture));
|
||||
var regEx = new Regex("\\b" + words[i] + "\\b", (RegexOptions.CultureInvariant | RegexOptions.ExplicitCapture));
|
||||
count += regEx.Matches(text).Count;
|
||||
}
|
||||
return count;
|
||||
@ -3435,5 +3435,18 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
return lines;
|
||||
}
|
||||
|
||||
public static void FixLargeFonts(Control mainCtrl, Control ctrl)
|
||||
{
|
||||
using (Graphics graphics = mainCtrl.CreateGraphics())
|
||||
{
|
||||
SizeF textSize = graphics.MeasureString(ctrl.Text, mainCtrl.Font);
|
||||
if (textSize.Height > ctrl.Height - 4)
|
||||
{
|
||||
int newButtonHeight = (int)(textSize.Height + 7.5);
|
||||
SetButtonHeight(mainCtrl, newButtonHeight, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user