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,24 +271,28 @@ 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();
// TODO: horizontal orientation }
if (HorizontalOrientation) }
{
Refresh();
}
else
{
int x = _hBar.Value;
int y = ColumnHeight;
int w = VisibleColumns.Any() public void Redraw()
? Math.Min(VisibleColumns.Max(c => c.Right) - _hBar.Value, Width) {
: 0; // TODO: horizontal orientation
if (HorizontalOrientation)
{
Refresh();
}
else
{
int x = _hBar.Value;
int y = ColumnHeight + 1;
int h = Height - y; int w = VisibleColumns.Any()
Invalidate(new Rectangle(x, y, w, h)); ? Math.Min(VisibleColumns.Max(c => c.Right) - _hBar.Value, Width)
} : 0;
int h = Height - y;
Invalidate(new Rectangle(x, y, w, h));
} }
} }