public GridScreen(Rectangle bounds, KeyMap map)
 {
     Bounds = bounds;
     Root = new RootPanel(InnerRect);
     ActivePanel = Root;
     Map = map;
 }
 /// <summary>
 /// 子パネル用コンストラクタ
 /// </summary>
 /// <param name="parent"></param>
 /// <param name="g"></param>
 /// <param name="division"></param>
 /// <param name="x"></param>
 /// <param name="y"></param>
 /// <param name="key"></param>
 public GridPanel(AbstractPanel parent, Graphics g, Point division, int x, int y, string key)
 {
     Parent = parent;
     MapPosition = new Point(x, y);
     var width = parent.Bounds.Width / division.X;
     var height = parent.Bounds.Height / division.Y;
     Bounds = new Rectangle
     {
         X = parent.Bounds.X + width * x,
         Y = parent.Bounds.Y + height * y,
         Width = width,
         Height = height,
     };
     _FontSize = CalcFontSize(g);
     KeyCharacter = key;
 }
 /// <summary>
 /// 再帰的に描画
 /// </summary>
 /// <param name="g"></param>
 /// <param name="panel"></param>
 protected void Paint(Graphics g, AbstractPanel panel, AbstractPanel ignorePanel, bool isCharacterVisible)
 {
     panel.PaintChildren(g, ignorePanel, isCharacterVisible);
     if (panel.HasParent)
     {
         Paint(g, panel.Parent, panel, false);
     }
 }
 public Point Select(Graphics g, string key)
 {
     if (ActivePanel.DicChildren.ContainsKey(key))
     {
         ActivePanel = ActivePanel.DicChildren[key];
         ActivePanel.CreateChildren(g, Map);
     }
     var point = ActivePanel.CursorPoint;
     return new Point
     {
         X = point.X + Left,
         Y = point.Y + Top,
     };
 }
 public void Reset()
 {
     ActivePanel = Root;
 }
 /// <summary>
 /// ignorePanelを除いた子パネルをすべて描画
 /// </summary>
 /// <param name="g"></param>
 /// <param name="ignorePanel"></param>
 /// <param name="isCharacterVisible"></param>
 /// <remarks>
 /// 最下部のパネルから描画するため、ignorePanelを除かないと描画済みのパネルも上書きしてしまう。
 /// なお、再帰的に描画すると指数関数的にオブジェクトが増えるので、必要なもののみ描画する。
 /// </remarks>
 public void PaintChildren(Graphics g, AbstractPanel ignorePanel, bool isCharacterVisible)
 {
     foreach (var child in DicChildren.Values)
     {
         if (ignorePanel != null && child.Bounds.Equals(ignorePanel.Bounds))
         {
             continue;
         }
         child.Paint(g, isCharacterVisible);
     }
 }