当Alignment =TabAlignment.Bottom时,页签文字偏上问题修复。

This commit is contained in:
dazuo0312 2021-10-12 17:40:29 +08:00
parent a756a94193
commit 3143d2f775

View File

@ -476,8 +476,14 @@ namespace Sunny.UI
if (TabSelectedHighColorSize > 0) if (TabSelectedHighColorSize > 0)
g.FillRectangle(TabSelectedHighColor, 0, bmp.Height - TabSelectedHighColorSize, bmp.Width, TabSelectedHighColorSize); g.FillRectangle(TabSelectedHighColor, 0, bmp.Height - TabSelectedHighColorSize, bmp.Width, TabSelectedHighColorSize);
} }
if(Alignment ==TabAlignment.Bottom )
{
g.DrawString(TabPages[index].Text, Font, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, textLeft, 2 + (TabRect.Height - sf.Height + 4) / 2.0f);
}
else
{
g.DrawString(TabPages[index].Text, Font, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, textLeft, 2 + (TabRect.Height - sf.Height - 4) / 2.0f); g.DrawString(TabPages[index].Text, Font, index == SelectedIndex ? tabSelectedForeColor : TabUnSelectedForeColor, textLeft, 2 + (TabRect.Height - sf.Height - 4) / 2.0f);
}
var menuItem = Helper[index]; var menuItem = Helper[index];
bool show1 = TabPages[index].Text != MainPage; bool show1 = TabPages[index].Text != MainPage;