InputRoll - do not draw column header if not necessary

This commit is contained in:
adelikat 2019-12-06 20:58:19 -06:00
parent ae239a0b1d
commit 0e03696b93
2 changed files with 22 additions and 17 deletions

View File

@ -30,7 +30,8 @@ namespace BizHawk.Client.EmuHawk
var lastVisibleRow = firstVisibleRow + CalcVisibleRows(e.ClipRectangle); var lastVisibleRow = firstVisibleRow + CalcVisibleRows(e.ClipRectangle);
CalculateHorizontalColumnPositions(visibleColumns); CalculateHorizontalColumnPositions(visibleColumns);
if (visibleColumns.Any()) var needsColumnRedraw = HorizontalOrientation || e.ClipRectangle.Y < ColumnHeight;
if (visibleColumns.Any() && needsColumnRedraw)
{ {
DrawColumnBg(visibleColumns); DrawColumnBg(visibleColumns);
DrawColumnText(visibleColumns); DrawColumnText(visibleColumns);

View File

@ -271,7 +271,12 @@ namespace BizHawk.Client.EmuHawk
// Similarly to ListView in virtual mode, we want to always refresh // Similarly to ListView in virtual mode, we want to always refresh
// when setting row count, that gives the calling code assurance that // when setting row count, that gives the calling code assurance that
// redraw will happen // redraw will happen
Redraw();
}
}
public void Redraw()
{
// TODO: horizontal orientation // TODO: horizontal orientation
if (HorizontalOrientation) if (HorizontalOrientation)
{ {
@ -280,7 +285,7 @@ namespace BizHawk.Client.EmuHawk
else else
{ {
int x = _hBar.Value; int x = _hBar.Value;
int y = ColumnHeight; int y = ColumnHeight + 1;
int w = VisibleColumns.Any() int w = VisibleColumns.Any()
? Math.Min(VisibleColumns.Max(c => c.Right) - _hBar.Value, Width) ? Math.Min(VisibleColumns.Max(c => c.Right) - _hBar.Value, Width)
@ -290,7 +295,6 @@ namespace BizHawk.Client.EmuHawk
Invalidate(new Rectangle(x, y, w, h)); Invalidate(new Rectangle(x, y, w, h));
} }
} }
}
/// <summary> /// <summary>
/// Gets or sets a value indicating whether columns can be resized /// Gets or sets a value indicating whether columns can be resized