From 0e03696b93cbec054e433534e10b67e7c2978528 Mon Sep 17 00:00:00 2001 From: adelikat Date: Fri, 6 Dec 2019 20:58:19 -0600 Subject: [PATCH] InputRoll - do not draw column header if not necessary --- .../InputRoll/InputRoll.Drawing.cs | 3 +- .../CustomControls/InputRoll/InputRoll.cs | 36 ++++++++++--------- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs index ba16b89f99..8ecebcf382 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.Drawing.cs @@ -30,7 +30,8 @@ namespace BizHawk.Client.EmuHawk var lastVisibleRow = firstVisibleRow + CalcVisibleRows(e.ClipRectangle); CalculateHorizontalColumnPositions(visibleColumns); - if (visibleColumns.Any()) + var needsColumnRedraw = HorizontalOrientation || e.ClipRectangle.Y < ColumnHeight; + if (visibleColumns.Any() && needsColumnRedraw) { DrawColumnBg(visibleColumns); DrawColumnText(visibleColumns); diff --git a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs index 781dd2c585..dc56a21669 100644 --- a/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs +++ b/BizHawk.Client.EmuHawk/CustomControls/InputRoll/InputRoll.cs @@ -271,24 +271,28 @@ namespace BizHawk.Client.EmuHawk // Similarly to ListView in virtual mode, we want to always refresh // when setting row count, that gives the calling code assurance that // redraw will happen - - // TODO: horizontal orientation - if (HorizontalOrientation) - { - Refresh(); - } - else - { - int x = _hBar.Value; - int y = ColumnHeight; + Redraw(); + } + } - int w = VisibleColumns.Any() - ? Math.Min(VisibleColumns.Max(c => c.Right) - _hBar.Value, Width) - : 0; + public void Redraw() + { + // TODO: horizontal orientation + if (HorizontalOrientation) + { + Refresh(); + } + else + { + int x = _hBar.Value; + int y = ColumnHeight + 1; - int h = Height - y; - Invalidate(new Rectangle(x, y, w, h)); - } + int w = VisibleColumns.Any() + ? Math.Min(VisibleColumns.Max(c => c.Right) - _hBar.Value, Width) + : 0; + + int h = Height - y; + Invalidate(new Rectangle(x, y, w, h)); } }