InputRoll - if column resize is enabled, double clicking a column edge resizes it to fit the text

This commit is contained in:
adelikat 2019-10-19 11:45:18 -05:00
parent fb2048075c
commit 7428a5d244
1 changed files with 35 additions and 0 deletions

View File

@ -135,6 +135,41 @@ namespace BizHawk.Client.EmuHawk
base.Dispose(disposing);
}
protected override void OnDoubleClick(EventArgs e)
{
if (IsHoveringOnColumnEdge)
{
if (HorizontalOrientation)
{
// TODO
}
else
{
var maxLength = CurrentCell.Column.Text?.Length ?? 0;
for (int i = 0; i < RowCount; i++)
{
string text = "";
int offSetX = 0, offSetY = 0;
QueryItemText?.Invoke(i, CurrentCell.Column, out text, ref offSetX, ref offSetY);
if (text.Length > maxLength)
{
maxLength = text.Length;
}
}
var newWidth = (maxLength * _charSize.Width) + (CellWidthPadding * 2);
CurrentCell.Column.Width = newWidth;
_columns.ColumnsChanged();
Refresh();
}
}
base.OnDoubleClick(e);
}
#region Properties
/// <summary>