41 lines
646 B
C#
41 lines
646 B
C#
using System;
|
|
|
|
namespace GoldPrinter
|
|
{
|
|
public class Header : Outer
|
|
{
|
|
private const int CONST_MAX_ROWS = 10;
|
|
|
|
private readonly int MAX_ROWS;
|
|
|
|
public Header()
|
|
{
|
|
this.MAX_ROWS = this.SetMaxRows();
|
|
}
|
|
|
|
protected virtual int SetMaxRows()
|
|
{
|
|
return 10;
|
|
}
|
|
|
|
public Header(int rows, int cols) : this()
|
|
{
|
|
this.Initialize(rows, cols);
|
|
}
|
|
|
|
public override void Initialize(int rows, int cols)
|
|
{
|
|
int num = rows;
|
|
if (num < 0)
|
|
{
|
|
num = 0;
|
|
}
|
|
if (num > this.MAX_ROWS)
|
|
{
|
|
throw new Exception("行数限制在“" + this.MAX_ROWS.ToString() + "”行以内!");
|
|
}
|
|
base.Initialize(num, cols);
|
|
}
|
|
}
|
|
}
|