mirror of
https://github.com/colhountech/DarkUI.Net5.git
synced 2025-07-17 10:06:13 +03:00
Fixed label offsets on tabs.
This commit is contained in:
parent
04f116d333
commit
6e39da04da
@ -178,7 +178,13 @@ namespace DarkUI.Docking
|
|||||||
width = tab.CalculateWidth(g, Font);
|
width = tab.CalculateWidth(g, Font);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add area for the close button
|
// Add addition 5px width to tool window tabs
|
||||||
|
if (DockArea != DarkDockArea.Document)
|
||||||
|
{
|
||||||
|
width += 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add additional width for document tab items
|
||||||
if (DockArea == DarkDockArea.Document)
|
if (DockArea == DarkDockArea.Document)
|
||||||
{
|
{
|
||||||
width += closeButtonSize;
|
width += closeButtonSize;
|
||||||
@ -403,7 +409,7 @@ namespace DarkUI.Docking
|
|||||||
|
|
||||||
var tabTextFormat = new StringFormat
|
var tabTextFormat = new StringFormat
|
||||||
{
|
{
|
||||||
Alignment = StringAlignment.Near,
|
Alignment = StringAlignment.Center,
|
||||||
LineAlignment = StringAlignment.Center,
|
LineAlignment = StringAlignment.Center,
|
||||||
FormatFlags = StringFormatFlags.NoWrap
|
FormatFlags = StringFormatFlags.NoWrap
|
||||||
};
|
};
|
||||||
@ -412,7 +418,7 @@ namespace DarkUI.Docking
|
|||||||
var textColor = isVisibleTab ? Colors.LightText : Colors.DisabledText;
|
var textColor = isVisibleTab ? Colors.LightText : Colors.DisabledText;
|
||||||
using (var b = new SolidBrush(textColor))
|
using (var b = new SolidBrush(textColor))
|
||||||
{
|
{
|
||||||
var textRect = new Rectangle(tabRect.Left + 5 + xOffset, tabRect.Top, tabRect.Width - tab.CloseButtonRectangle.Width - 7 - 5 - xOffset, tabRect.Height);
|
var textRect = new Rectangle(tabRect.Left + 2 + xOffset, tabRect.Top, tabRect.Width - tab.CloseButtonRectangle.Width - 7 - 5 - xOffset, tabRect.Height);
|
||||||
g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
|
g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -458,7 +464,7 @@ namespace DarkUI.Docking
|
|||||||
|
|
||||||
var tabTextFormat = new StringFormat
|
var tabTextFormat = new StringFormat
|
||||||
{
|
{
|
||||||
Alignment = StringAlignment.Near,
|
Alignment = StringAlignment.Center,
|
||||||
LineAlignment = StringAlignment.Center,
|
LineAlignment = StringAlignment.Center,
|
||||||
FormatFlags = StringFormatFlags.NoWrap,
|
FormatFlags = StringFormatFlags.NoWrap,
|
||||||
Trimming = StringTrimming.EllipsisCharacter
|
Trimming = StringTrimming.EllipsisCharacter
|
||||||
@ -467,7 +473,7 @@ namespace DarkUI.Docking
|
|||||||
var textColor = isVisibleTab ? Colors.BlueHighlight : Colors.DisabledText;
|
var textColor = isVisibleTab ? Colors.BlueHighlight : Colors.DisabledText;
|
||||||
using (var b = new SolidBrush(textColor))
|
using (var b = new SolidBrush(textColor))
|
||||||
{
|
{
|
||||||
var textRect = new Rectangle(tabRect.Left + 5, tabRect.Top, tabRect.Width - 5, tabRect.Height);
|
var textRect = new Rectangle(tabRect.Left, tabRect.Top, tabRect.Width - 2, tabRect.Height);
|
||||||
g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
|
g.DrawString(tab.DockContent.DockText, Font, b, textRect, tabTextFormat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ namespace DarkUI.Docking
|
|||||||
|
|
||||||
public int CalculateWidth(Graphics g, Font font)
|
public int CalculateWidth(Graphics g, Font font)
|
||||||
{
|
{
|
||||||
var width = (int)g.MeasureString(DockContent.DockText, font).Width;
|
var width = (int)g.MeasureString(DockContent.DockText, font, 0, StringFormat.GenericTypographic).Width;
|
||||||
width += 10;
|
width += 10;
|
||||||
|
|
||||||
return width;
|
return width;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user