Input Roll - implement the gridlines property

This commit is contained in:
adelikat 2014-08-23 23:03:19 +00:00
parent 5dc7327c1f
commit 338dc124bd
1 changed files with 33 additions and 31 deletions

View File

@ -87,7 +87,6 @@ namespace BizHawk.Client.EmuHawk
[Category("Behavior")] [Category("Behavior")]
public int CellPadding { get; set; } public int CellPadding { get; set; }
// TODO: implement this
/// <summary> /// <summary>
/// Displays grid lines around cells /// Displays grid lines around cells
/// </summary> /// </summary>
@ -653,43 +652,46 @@ namespace BizHawk.Client.EmuHawk
Gdi.SetSolidPen(Color.Black); Gdi.SetSolidPen(Color.Black);
Gdi.DrawRectangle(startPoint.X, startPoint.Y, Width, Height); Gdi.DrawRectangle(startPoint.X, startPoint.Y, Width, Height);
Gdi.SetSolidPen(SystemColors.ControlLight); if (GridLines)
if (HorizontalOrientation)
{ {
// Columns Gdi.SetSolidPen(SystemColors.ControlLight);
for (int i = 1; i < Width / CellWidth; i++) if (HorizontalOrientation)
{ {
var x = _horizontalOrientedColumnWidth + 1 + (i * CellWidth); // Columns
var y2 = (_columns.Count * CellHeight) - 1; for (int i = 1; i < Width / CellWidth; i++)
if (y2 > Height)
{ {
y2 = Height - 2; var x = _horizontalOrientedColumnWidth + 1 + (i * CellWidth);
var y2 = (_columns.Count * CellHeight) - 1;
if (y2 > Height)
{
y2 = Height - 2;
}
Gdi.Line(x, 1, x, y2);
} }
Gdi.Line(x, 1, x, y2); // Rows
for (int i = 1; i < _columns.Count + 1; i++)
{
Gdi.Line(_horizontalOrientedColumnWidth + 1, i * CellHeight, Width - 2, i * CellHeight);
}
} }
else
{
// Columns
int x = 0;
int y = CellHeight + 1;
foreach (var column in _columns)
{
x += CalcWidth(column);
Gdi.Line(x, y, x, Height - 1);
}
// Rows // Rows
for (int i = 1; i < _columns.Count + 1; i++) for (int i = 2; i < (Height / CellHeight) + 1; i++)
{ {
Gdi.Line(_horizontalOrientedColumnWidth + 1, i * CellHeight, Width - 2, i * CellHeight); Gdi.Line(1, (i * CellHeight) + 1, Width - 2, (i * CellHeight) + 1);
} }
}
else
{
// Columns
int x = 0;
int y = CellHeight + 1;
foreach (var column in _columns)
{
x += CalcWidth(column);
Gdi.Line(x, y, x, Height - 1);
}
// Rows
for (int i = 2; i < (Height / CellHeight) + 1; i++)
{
Gdi.Line(1, (i * CellHeight) + 1, Width - 2, (i * CellHeight) + 1);
} }
} }