本文整理汇总了C#中System.Windows.Forms.ToolStripItemTextRenderEventArgs.SizeTextRectangleToText方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripItemTextRenderEventArgs.SizeTextRectangleToText方法的具体用法?C# ToolStripItemTextRenderEventArgs.SizeTextRectangleToText怎么用?C# ToolStripItemTextRenderEventArgs.SizeTextRectangleToText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.ToolStripItemTextRenderEventArgs
的用法示例。
在下文中一共展示了ToolStripItemTextRenderEventArgs.SizeTextRectangleToText方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnRenderItemText
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
{
// Without this, the ToolStrip renderer leaves some border artifacts
// even when the style is set to "no border".
e.SizeTextRectangleToText();
base.OnRenderItemText(e);
}
示例2: OnRenderItemText
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
{
// set the font before calculating the size because bold text is being cut off in Linux.
TabStripButton btn = e.Item as TabStripButton;
if ((btn != null) && btn.Checked)
e.TextFont = btn.SelectedFont;
e.SizeTextRectangleToText();
// adjust the text position up for Linux
var rect = e.TextRectangle;
if (SIL.PlatformUtilities.Platform.IsLinux)
rect.Offset(0, -2);
else
rect.Offset(0, 8); // hatton for bloom lower is better
if (btn != null)
{
var delta = ((Mirrored) ? -1 : 1) * ((btn.Checked) ? 1 : selOffset);
if (e.ToolStrip.Orientation == Orientation.Horizontal)
rect.Offset((Mirrored) ? 2 : 1, delta + ((Mirrored) ? 1 : -1));
else
rect.Offset(delta + 2, 0);
if (btn.Selected)
e.TextColor = btn.HotTextColor;
else if (btn.Checked)
e.TextColor = btn.SelectedTextColor;
}
e.TextRectangle = rect;
if (_currentRenderer != null)
_currentRenderer.DrawItemText(e);
else
base.OnRenderItemText(e);
}
示例3: OnRenderItemText
protected override void OnRenderItemText(ToolStripItemTextRenderEventArgs e)
{
// this is needed, especially on Linux
e.SizeTextRectangleToText();
base.OnRenderItemText(e);
}