public ClickDeKaishiState(EPuzzleWindow window, WindowState previousState, WindowState nextState, string text)
            : base(window)
        {
            if (null == nextState) throw new ArgumentNullException();
            if (null == previousState) throw new ArgumentNullException();

            PreviousStates.Add(previousState);
            NextStates.Add(nextState);
            var label = new EigoTestLabelItem()
            {
                Color = Color.Gray,
            //				Text = "クリックまたは打鍵で開始します",
                Text = text,
                Location = new Point(0, 0),
                Size = new SizeF(DrawingObjectRoot.Width, DrawingObjectRoot.Height),
                Font = EPuzzleFonts.クリックで開始します,
            };
            Items.Add(label);

            Action0 += (sender, e) =>
            {
                Window.State = NextState;
                Window.ChumonResult = new ChumonResult(window.EPuzzleData.CurrentUserInfo);
            };
            Action3 += (sender, e) =>
            {
                Window.State = PreviousState;
            };
        }
        public AnkimonRowContainer()
        {
            Position = DrawingObjectPosition.Relative;
            Height = WordCard.WordCardHeight;
            var label = new EigoTestLabelItem()
            {
                Width = 100, Height = WordCard.WordCardHeight,
            };
            Items.Add(label);

            var wordCardContainer = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = label.OuterWidth,
            };
            var wordCardCollection = (DrawingObjectCollection)wordCardContainer.Items;
            wordCardCollection.CollectionChanged += (sender, e) =>
            {
                PropertyChangedEventHandler propertyChanged = (xx, x) =>
                {
                    if ("Width" != x.PropertyName) return;
                    WordCardの整列((IList<EigoTestDrawingObject>)sender);
                };
                if (null != e.NewItems)
                {
                    foreach (var newItem in e.NewItems.Cast<WordCard>())
                    {
                        newItem.Position = DrawingObjectPosition.Absolute;
                        newItem.MarginLeft = WordCardMarginLeft;
                        newItem.MarginTop = 0;
                        newItem.MarginRight = 0;
                        newItem.MarginBottom = 0;
                        newItem.PropertyChanged += propertyChanged;
                    }
                }
                if (null != e.OldItems)
                {
                    foreach (var oldItem in e.OldItems.Cast<WordCard>())
                    {
                        oldItem.PropertyChanged -= propertyChanged;
                    }
                }
                WordCardの整列((IList<EigoTestDrawingObject>)sender);
            };
            Items.Add(wordCardContainer);

            ((DrawingObjectCollection)Items).CollectionChanged += (sender, e) =>
            {
                throw new InvalidOperationException("AnkimonRowContainerの構成要素は変更できません。");
            };
        }
 public SampleState(EPuzzleWindow window, string text)
     : base(window)
 {
     var label = new EigoTestLabelItem()
     {
         Color = Color.Gray,
         Text = text,
         Location = new Point(0, 0),
         Size = new SizeF(DrawingObjectRoot.Width, DrawingObjectRoot.Height),
         Font = EPuzzleFonts.クリックで開始します,
     };
     label.Click += (sender, e) =>
     {
         Window.State = NextState;
     };
     Items.Add(label);
 }
        public InformationState(EPuzzleWindow window, WindowState parentState, string text)
            : base(window)
        {
            _parentState = parentState;
            var container = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Absolute,
                Width = DrawingObjectRoot.Width / 2f,
                Height = DrawingObjectRoot.Height / 2f,
            //				BackColor =
            };
            Items.Add(container);

            _textLabel = new EigoTestLabelItem()
            {
                Text = text,
            //				Width = container.Width,
                Height = container.Height * 0.8f,
                BackColor = EPuzzleColors.ColorAlpha01,
            };
            container.Items.Add(_textLabel);

            var okButton = new EigoTestButtonItem()
            {
                Text = "OK", Name = "ok",
            //				Width = 100,
                Height = 60,
            };
            container.Items.Add(okButton);
            container.水平方向に中央揃え();
            container.垂直方向に中央揃え();

            Action0 += (sender, e) =>
            {
                if (null == CurrentItem) return;
                if ("ok" == CurrentItem.Name)
                {
                    Window.State = parentState;
                }
            };
        }
        public ChumonResultState(EPuzzleWindow window, EigoTestMondai mondai, ChumonResult chumonResult, MondaiResult mondaiResult)
            : base(window)
        {
            _mondai = mondai;
            _chumonResult = chumonResult;

            DrawingObjectRoot.BackColor = EPuzzleColors.Color109;

            //			var imageFile = ResultImageManager.Instance.GetFile(_mondai.Parent.GetGradeString(mondaiResult.所要時間));
            //			var imageFile = ResultImageManager.Instance.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間));
            var image = window.EPuzzleData.CurrentUserInfo.ResultImageManager.GetImage(_mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo));
            if (null != image)
            {
            //				var imageItem = new ImageItem(imageFile, true);
                var imageItem = new ImageItem(image.Shrink((int)DrawingObjectRoot.Width, (int)DrawingObjectRoot.Height));
                imageItem.Left = 0f;
                imageItem.Top = 0f;
                imageItem.Position = DrawingObjectPosition.Absolute;
                Items.Add(imageItem);

            #if DEBUG
                { // 使用したファイルの記録
                    var imagePath = (string)image.Tag;
                    Clipboard.SetText(imagePath);

                    var path = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "usedImages.txt");
                    File.AppendAllText(path, imagePath + Environment.NewLine);
                }
            #endif // DEBUG

            //				ResultImageManager.Instance.UpdateAccessTime(fileName);
            //				ResultImageManager.Instance.SaveFileIfItPassed(TimeSpan.FromMinutes(10d));
            }

            var w1 = 180f;
            var h1 = EPuzzleFonts.ChumonResultState_Default.Height;
            var backColor = EPuzzleColors.Color107;

            var kirokuBox = new KirokuBox2()
            {
                BorderLine = false,
                Position = DrawingObjectPosition.Absolute,
                Width = 200,
                UserInfo = Window.EPuzzleData.CurrentUserInfo,
                Chumon = (Chumon)_mondai.Parent,
                Color = EPuzzleColors.ChumonResultState_KirokuBox2_Color,
                BackColor = EPuzzleColors.ChumonResultState_KirokuBox2_BackColor,
                BackColorA = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorA,
                BackColorB = EPuzzleColors.ChumonResultState_KirokuBox2_BackColorB,
                LineColor = EPuzzleColors.ChumonResultState_KirokuBox2_LineColor,
                NodeColor = EPuzzleColors.ChumonResultState_KirokuBox2_NodeColor,
            };
            Items.Add(kirokuBox);

            var box = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Absolute,
                Color = EPuzzleColors.Color108,
                BackColor = backColor,
                Width = w1,
                PaddingLeft = 10f, PaddingRight = 10f,
                PaddingTop = 10f, PaddingBottom = 10f,
                BorderLine = false,
            };
            Items.Add(box);

            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = mondai.Parent.LongName,
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("グレード: {0}({1:0.00})", mondai.Parent.GetGradeString(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo), mondai.Parent.GetGrade(mondaiResult.所要時間, window.EPuzzleData.CurrentUserInfo)),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var duration = mondai.Parent.復習までの猶予期間を取得(window.EPuzzleData.CurrentUserInfo);
                if (null != duration)
                {
                    var item = new EigoTestLabelItem()
                    {
                        Color = EPuzzleColors.Color108,
                        Text = string.Format("復習猶予期間: {0:0.0}日", ((TimeSpan)duration).TotalDays),
                        Font = EPuzzleFonts.ChumonResultState_Default,
                        Width = w1,
                        Height = h1,
                        StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                    };
                    box.Items.Add(item);
                }
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("基準時間: {0}", EigoTestMondai.符号無時間文字列(_mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("所要時間: {0}", EigoTestMondai.符号無時間文字列(mondaiResult.所要時間)),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            {
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("基準との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - _mondai.Parent.GetTimeLimit(window.EPuzzleData.CurrentUserInfo))),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }
            /*			{
                var item = new EigoTestLabelItem()
                {
                    Color = EPuzzleColors.Color108,
                    Text = string.Format("Perfect: {0}", string.Join("", chumonResult.ShomonResults.Select(x => x.IsPerfect ? "■" : "□").ToArray())),
                    Font = EPuzzleFonts.ChumonResultState_Default,
                    Width = w1,
                    Height = h1,
                    StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                };
                box.Items.Add(item);
            }*/
            {
                var height = 25f;
                var stars = chumonResult.ShomonResults.Select(x =>
                {
                    var star = new Pentagram(2)
                    {
                        Color = EPuzzleColors.PerfectStarOnChumonResultState,
                        Width = height,
                        Height = height,
                        Tag = x.IsPerfect,
                        PaddingLeft = 3f,
                        PaddingBottom = 3f,
                    };
                    return star;
                }).ToArray();
            /*				for (int i = 0; i < stars.Length; i++)
                {
                    stars[i].Left = stars[0].OuterWidth * i;
                    stars[i].Top = DrawingObjectRoot.Height - stars[0].OuterHeight;
                }
                */
                for (int i = 0; i < stars.Length; i++)
                {
                    stars[i].Left = stars[0].OuterWidth * i;
                    stars[i].Top = 0f;
                }

                if (stars.Any())
                {
                    var starbox = new DrawingObjectContainer()
                    {
                        Position = DrawingObjectPosition.Absolute,
                        Left = 0f,
                        Top = DrawingObjectRoot.Height - stars.First().OuterHeight,
                        Width = stars.Last().OuterRight - stars.First().OuterLeft,
                        Height = stars.First().OuterHeight,
            //						BackColor = EPuzzleColors.Color107,
                    };
                    starbox.Items.AddRange(stars);
                    Items.Add(starbox);
                }
            //				Items.AddRange(stars);
            }

            /*			{
                var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id);
                if (null != bestMondaiResult)
                {
                    var item = new EigoTestLabelItem()
                    {
                        Color = EPuzzleColors.Color108,
                        Text = string.Format("最速記録: {0}", EigoTestMondai.符号無時間文字列(bestMondaiResult.所要時間)),
                        Font = EPuzzleFonts.ChumonResultState_Default,
                        Width = w1,
                        Height = h1,
                        StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                    };
                    box.Items.Add(item);
                }
            }
            {
                var bestMondaiResult = window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(mondai.Parent.Id);
                if (null != bestMondaiResult)
                {
                    var item = new EigoTestLabelItem()
                    {
                        Color = EPuzzleColors.Color108,
                        Text = string.Format("最速との差: {0}", EigoTestMondai.符号付時間文字列(mondaiResult.所要時間 - bestMondaiResult.所要時間)),
                        Font = EPuzzleFonts.ChumonResultState_Default,
                        Width = w1,
                        Height = h1,
                        StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Center, },
                    };
                    box.Items.Add(item);
                }
            }*/

            /*			var retryButton = new EigoTestButtonItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Color = EPuzzleColors.Color108,
                Text = "再挑戦",
                Name = "retryButton",
                Font = EPuzzleFonts.ChumonResultState_Default,
                Width = 80,
                Height = h1,
            };
            Items.Add(retryButton);*/

            /*
            // 右がbox
            box.Left = DrawingObjectRoot.Width - ( box.OuterWidth + kirokuBox.OuterWidth );
            box.Top = DrawingObjectRoot.Height - box.OuterHeight;

            kirokuBox.Height = box.OuterHeight;
            kirokuBox.Left = DrawingObjectRoot.Width - kirokuBox.OuterWidth;
            kirokuBox.Top = box.Top;
            */

            box.Left = DrawingObjectRoot.Width - box.OuterWidth;
            box.Top = DrawingObjectRoot.Height - box.OuterHeight;

            kirokuBox.Height = box.OuterHeight;
            kirokuBox.Left = box.OuterLeft - kirokuBox.OuterWidth;
            kirokuBox.Top = box.Top;

            Action0 += (sender, e) =>
            {
                MouseUpInternal(new MouseEventInfo(new PointF(0f, 0f), MouseButtons.Left));
            };
        }
        public override void UpdateItemsToBeDrawn()
        {
            var currentItemInfo = SaveCurrentItem();

            Items.Clear();
            CurrentItem = null;

            var userInfo = Window.EPuzzleData.CurrentUserInfo;

            var w = DrawingObjectRoot.Width;
            var h = DrawingObjectRoot.Height;

            var h0 = 60f;
            var h1 = 120f;
            var h2 = 60f;
            var h4 = 60f;

            var h3 = h - ( h0 + h1 + h2 + h4 );
            var w0 = w / 2f;
            var w1 = w0;
            var w3 = 20f;

            var x0 = 0f;
            var x1 = w0;

            var y0 = 0f;
            var y1 = y0 + h0;
            var y2 = y1 + h1;
            var y3 = y2 + h2;
            var y4 = y3 + h3;

            var font0 = EPuzzleFonts.GetMsGothic((int)Math.Round(h0 / 3d));
            var font1 = EPuzzleFonts.GetEnSansSerif(Shomon.Mondaibun, (int)Math.Round(h1 / 2d / 3d));
            var font2 = EPuzzleFonts.GetFont("Arial", (int)Math.Round(h2 / 3d));
            var font3 = EPuzzleFonts.GetMsGothic((int)Math.Round(h4 / 4d));

            var chumonTitle = new EigoTestLabelItem(Shomon.Parent.LongName)
            {
                Position = DrawingObjectPosition.Absolute,
                Left = x0,
                Top = y0,
            //				Width = 400,
                Height = h0,
                Font = font0,
                MarginLeft = w3,
                Name = "title",
                StringFormat = new StringFormat()
                {
                    Alignment = StringAlignment.Center,
                    LineAlignment = StringAlignment.Center,
                },

            //				BorderLine = true,
            };
            Items.Add(chumonTitle);

            var mondaiBun = new EigoTestLabelItem()
            {
                Left = x0,
                Top = y1,
            //				Width = 600,
                Height = h1,
                Font = font1,
            //				MarginLeft = w3,
                StringFormat = new StringFormat()
                {
                    Alignment = StringAlignment.Near,
                    LineAlignment = StringAlignment.Near,
                },

                Position = DrawingObjectPosition.Absolute,
            //				BorderLine = true,
                Name = "mondaibun",
                Color = Color.Black,
                Text = Shomon.Mondaibun,
            //				Font = EPuzzleFonts.問題文,

            /*				MarginLeft = 20,
                MarginRight = 20,
                MarginTop = 20,
                MarginBottom = 0,
                PaddingTop = 10,
                PaddingBottom = 10,*/
                PaddingLeft = 20,
                PaddingRight = 20,

                BorderLine = true,
            };
            Items.Add(mondaiBun);

            var answerBox = new AnswerBox()
            {
                Position = DrawingObjectPosition.Absolute,
                Name = "answerBox",
                Left = x0,
                Top = y2,
            //				Width = h1,
                Height = h2 + h3,
                Font = font2,
            //				MarginLeft = w3,
                StringFormat = new StringFormat()
                {
                    Alignment = StringAlignment.Near,
                    LineAlignment = StringAlignment.Near,
                },
            /*
                PaddingTop = 10,
                PaddingBottom = 10,*/
                PaddingLeft = 20,
                PaddingRight = 20,

                Color = Color.Blue,

                BorderLine = true,
            };
            answerBox.PropertyChanged += (sender, e) =>
            {
                if ("Text" == e.PropertyName)
                {
                    Invalidate();

                    var isCorrect = Shomon.正解判定(answerBox.Text);
                    if (!isCorrect) return;

                    Window.ChumonResult.ShomonResults.Add(new ShomonResult(Shomon, false));
                    // 正解したら次の状態に遷移
                    if (null == Shomon.NextItem)
                    {
                        var mondaiResult = _shomonStateHelper.GetMondaiResult();
                        Window.EPuzzleData.CurrentUserInfo.MondaiResults.Add(mondaiResult);
                        var medal = Window.ChumonResult.GetMedal();
                        if (null != medal)
                        {
                            Window.EPuzzleData.CurrentUserInfo.Medals.Add(medal);
                        }
                        Window.State = WindowState.FoFi(this, new ChumonResultState(Window, Shomon, Window.ChumonResult, mondaiResult));
                    }
                    else
                    {
                        Window.State = WindowState.FoFi(this, Window.CreateMondaiState(Shomon.NextItem));
                    }
                }
            };
            Items.Add(answerBox);

            var buttonContainer = new DrawingObjectContainer()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = x0,
                Top = y4,
                Height = h4,
                Color = EPuzzleColors.Color03,
                BorderLine = true,
            };
            Items.Add(buttonContainer);

            {
                var button = ShomonStateHelper.CreateButton("全消去", "clearAnswer", font3);
                button.Height = h4;
                buttonContainer.Items.Add(button);
            }
            {
                var button = ShomonStateHelper.CreateButton("正解を見る", "showCorrectAnswer", font3);
                button.Height = h4;
                buttonContainer.Items.Add(button);
            }
            {
                var button = ShomonStateHelper.CreateButton(AddShortcutKeys("PAUSE", Command.Action3), "pause", font3);
                button.Height = h4;
                buttonContainer.Items.Add(button);
            }
            if (Shomon.Sounds.Where(x => SoundIsPlayedWhen.UserRequest == x.IsPlayedWhen).Any())
            {
                var button = ShomonStateHelper.CreateButton(AddShortcutKeys("音声の再生", Command.Action4), "playSound", font3);
                button.Height = h4;
                buttonContainer.Items.Add(button);
            }
            if (((Chumon)Shomon.Parent).HelpIds.Any())
            {
                var button = ShomonStateHelper.CreateButton("情報を見る", "info", font3);
                button.Height = h4;
                buttonContainer.Items.Add(button);
            }
            // ここから右寄せ
            {
                var xx = w;
                {
                    var button = ShomonStateHelper.CreateButton("戻る", "back", font3);
                    button.Height = h4;
                    button.Position = DrawingObjectPosition.Absolute;
                    xx = xx - button.OuterWidth;
                    button.Left = xx;
                    buttonContainer.Items.Add(button);
                }
                {
                    var button = ShomonStateHelper.CreateButton("はじめから", "hajimekara", font3);
                    button.Height = h4;
                    button.Position = DrawingObjectPosition.Absolute;
                    xx = xx - button.OuterWidth;
                    button.Left = xx;
                    buttonContainer.Items.Add(button);
                }
            }

            RestoreCurrentItem(currentItemInfo);
        }
        public override void UpdateItemsToBeDrawn()
        {
            Items.Clear();

            var rect = Window.ClientRectangle;

            var button_color = Color.FromArgb(0xff, 0x00, 0x00, 0x80);

            var helpTextBox = CreateHelpTextBox();
            helpTextBox.Left = 840;
            helpTextBox.Top = 100;
            helpTextBox.Width = 150;
            helpTextBox.Height = 400;

            //			helpTextBox.Left = 0;
            //			helpTextBox.Top = 0;
            Items.Add(helpTextBox);

            var title_label = new EigoTestLabelItem()
            {
                MarginTop = 30f,
                MarginBottom = 30f,
                Color = button_color,
                BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde),
                BorderLine = true,
                Text = Daimon.Name,
                Height = 56f,
            };
            title_label.Font = EPuzzleFonts.GetFont("Arial", (int)(title_label.Height / 2f));
            title_label.MarginLeft = title_label.MarginRight = 300f;
            Items.Add(title_label);

            // 前の問題ドキュメントへ遷移するボタン
            var previousMondaiDocumentButton = new EigoTestButtonItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 800,
                Top = 10,
                Width = 40,
                Height = 40,
                Text = "↑",
                Name = "PreviousMondaiDocumentButton",
                IsVisible = Daimon.Parent.PreviousItem != null,
                IsClickable = Daimon.Parent.PreviousItem != null,
                HelpText = "前の問題ファイルに移動します。",
            };
            previousMondaiDocumentButton.Click += (sender, e) =>
            {
                if (e.Info.Button != MouseButtons.Left) return;
                OnActionUp();
            };
            Items.Add(previousMondaiDocumentButton);

            // 次の問題ドキュメントへ遷移するボタン
            var nextMondaiDocumentButton = new EigoTestButtonItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 850,
                Top = 10,
                Width = 40,
                Height = 40,
                Text = "↓",
                Name = "NextMondaiDocumentButton",
                IsVisible = Daimon.Parent.NextItem != null,
                IsClickable = Daimon.Parent.NextItem != null,
                HelpText = "次の問題ファイルに移動します。",
            };
            nextMondaiDocumentButton.Click += (sender, e) =>
            {
                if (e.Info.Button != MouseButtons.Left) return;
                OnActionDown();
            };
            Items.Add(nextMondaiDocumentButton);

            // 問題ドキュメントメニューへ遷移するボタン
            var mondaiDocumentMenuButton = new EigoTestButtonItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 900,
                Top = 10,
                Width = 40,
                Height = 40,
                Text = "=",
                Name = "MondaiMenuButton",
                HelpText = "問題ファイルの選択メニューに戻ります。",
            };
            mondaiDocumentMenuButton.Click += (sender, e) =>
            {
                MoveToMondaiDocumentMenuState();
            };
            Items.Add(mondaiDocumentMenuButton);

            // タイトルに戻るボタン
            _back_button = new EigoTestButtonItem()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 950,
                Top = 10,
                Width = 40,
                Height = 40,
                Text = "T",
                Name = "タイトル画面に戻る",
                HelpText = "タイトル画面に戻ります。",
            };
            _back_button.Font = EPuzzleFonts.GetMsGothic((int)(_back_button.Height / 2f));
            _back_button.Click += (sender, e) =>
            {
                MoveToStartGameState();
            };
            Items.Add(_back_button);

            // 成績グラフ
            _kirokuBox = new KirokuBox2()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 10,
                Top = 100,
                Width = 180,
                Height = 180,
                UserInfo = Window.EPuzzleData.CurrentUserInfo,
                Chumon = (Chumon)Daimon.Items.First(),
            };
            Items.Add(_kirokuBox);

            _kirokuInfoBox = new KirokuInfoBox()
            {
                Position = DrawingObjectPosition.Absolute,
                Left = 50,
                Top = 300,
                Width = 160,
                Height = 200,
                UserInfo = Window.EPuzzleData.CurrentUserInfo,
                Chumon = (Chumon)Daimon.Items.First(),
            };
            Items.Add(_kirokuInfoBox);

            var chumonButtonHeight = 36;
            var chumonButtonWidth = 600;
            _helpWithScroll.Items = Daimon.Items.OfType<Chumon>().ToArray();
            _chumonButtons = _helpWithScroll.GetItemsToBeShown().Select(x =>
            {
                var mondaiResult = Window.EPuzzleData.CurrentUserInfo.MondaiResults.GetBest(x.Id);
                var shoyou = null == mondaiResult ? TimeSpan.Zero : mondaiResult.所要時間;
            //				var button = new ChumonButton(new MondaiJirushi(Window.EPuzzleData.CurrentUserInfo, x), Window.EPuzzleData.CurrentUserInfo)
                var button = new ChumonButton(Window.EPuzzleData.CurrentUserInfo, x)
                {
                    Color = button_color,
                    BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde),
                    Height = chumonButtonHeight,
                    Size = new SizeF(chumonButtonWidth, chumonButtonHeight),
                };
                button.MarginLeft = button.MarginRight = (DrawingObjectRoot.Width - chumonButtonWidth) / 2f;
                button.Font = EPuzzleFonts.GetFont("Arial", (int)(button.Height / 2f));
                return button;
            }).ToArray();
            foreach (var chumonButton in _chumonButtons)
            {
                Items.Add(chumonButton);
            }

            // 発音問題ボタンを追加する
            /*			if (Window.EPuzzleData.発音問題を有効にする)
            {
                var chumonCreator = new ChumonCreator(Window.EPuzzleData.PronunciationInfoContainer);
                foreach (var chumonButton in _chumonButtons)
                {
                    var proChumon = chumonCreator.GetPronunciationChumon(chumonButton.Chumon);
                    if (null == proChumon) continue;
                    var button = new EigoTestButtonItem()
                    {
                        Position = DrawingObjectPosition.Absolute,
                        Left = chumonButton.BorderRight + 10,
                        Top = chumonButton.BorderTop,
                        Width = chumonButton.Height,
                        Height = chumonButton.Height,
                        Text = "P",
                        Name = "pron-mondai",
                        Tag = proChumon,
                        BorderLine = true,
                    };
                    Items.Add(button);
                }
            }*/

            // 次のDaimonへ遷移するボタン
            var nextButtonSize = new SizeF(30, 45);
            if (null != Daimon.NextItem)
            {
                var nextDaimonButton = new NextButton()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Color = button_color,
                    BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde),
                    Location = new PointF(Window.ClientRectangle.Width - nextButtonSize.Width - 10, Window.ClientRectangle.Height / 2 - nextButtonSize.Height / 2),
                    Size = nextButtonSize,
                    Name = "NextDaimon",
                };
                nextDaimonButton.Click += (sender, e) =>
                {
                    if (e.Info.Button != MouseButtons.Left) return;
                    MoveToNextDaimon();
            //					OnActionRight();
                };
                Items.Add(nextDaimonButton);
            }

            // 前のDaimonへ遷移するボタン
            if (null != Daimon.PreviousItem)
            {
                var previousButton = new PreviousButton()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Color = button_color,
                    BackColor = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde),
                    Location = new PointF(10, Window.ClientRectangle.Height / 2 - nextButtonSize.Height / 2),
                    Size = nextButtonSize,
                    Name = "PreviousDaimon",
                };
                previousButton.Click += (sender, e) =>
                {
                    if (e.Info.Button != MouseButtons.Left) return;
                    MoveToPreviousDaimon();
            //					OnActionLeft();
                };
                Items.Add(previousButton);
            }
            if (_helpWithScroll.NeedToShowButtonToScrollUp)
            {
                var upButton = new EigoTestButtonItem()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Left = 800,
                    Top = 10,
                    Width = 80,
                    Height = 40,
                    Text = "↑ " + _helpWithScroll.NumberOfUpperItems,
                    Name = "upButton",
                    IsVisible = true,
                    IsClickable = true,
                };
                Items.Add(upButton);
                upButton.水平方向に中央揃え();
            }
            if (_helpWithScroll.NeedToShowButtonToScrollDown)
            {
                var downButton = new EigoTestButtonItem()
                {
                    Position = DrawingObjectPosition.Absolute,
                    Left = 800,
                    Top = 718,
                    Width = 80,
                    Height = 40,
                    Text = "↓ " + _helpWithScroll.NumberOfLowerItems,
                    Name = "downButton",
                    IsVisible = true,
                    IsClickable = true,
                };
                Items.Add(downButton);
                downButton.水平方向に中央揃え();
            }

            {
                var label = CreateLabelToShowNumberOfQuestionsThatHaveBeenFinished();
                label.Top -= 100f;
                Items.Add(label);
            }

            var daimons = Daimon.Parent.Items.OfType<Daimon>().ToArray();
            var daimonIndex = daimons.GetIndexOf(x => object.ReferenceEquals(x, Daimon));
            var daimonButtonBox = new DaimonButtonBox(daimons, daimonIndex, Window.EPuzzleData.CurrentUserInfo)
            {
                Position = DrawingObjectPosition.Absolute,
                MarginBottom = 30f,
            };
            Items.Add(daimonButtonBox);
            daimonButtonBox.水平方向に中央揃え();
            daimonButtonBox.下揃え();
            LockButtons();
            CurrentItemにロックされていない最後の問題を設定する();
        }
        public StartGameState(EPuzzleWindow window, string[] mondaiDocumentIdsWhichAreUsedInTutorState)
            : base(window)
        {
            if (null == mondaiDocumentIdsWhichAreUsedInTutorState) throw new ArgumentNullException();

            var button_color = Color.FromArgb(0xff, 0x00, 0x00, 0x80);
            var button_background_color = Color.FromArgb(0xff, 0xb0, 0xc4, 0xde);
            var button_size = new SizeF(260, 45);
            var button_left = (DrawingObjectRoot.Width - button_size.Width) / 2;
            var button_top = button_size.Height + 200;

            var title_label = new EigoTestLabelItem()
            {
                MarginTop = 100,
                MarginBottom = 80,
                Color = button_color,
            //				Text = "英 文 復 習 ゲ ー ム",
                Text = Application.ProductName,
                Height = 72f,
            };
            title_label.Font = EPuzzleFonts.GetMsGothic((int)(title_label.Height / 2f));
            Items.Add(title_label);

            // 問題ファイルを選ぶ
            _start_game_button = new EigoTestButtonItem()
            {
                MarginTop = button_size.Height / 3f,
                MarginLeft = button_left,
                Name = "StartGameButton",
                Text = "問題を選択する",
                Color = button_color,
                BackColor = button_background_color,
                Size = button_size,
                HelpText = "プレイする問題ファイルを選択します。",
            };
            _start_game_button.Click += (sender, e) =>
            {
                if (e.Info.Button != MouseButtons.Left) return;
                MoveToMondaiDocumentMenuState();
            };

            /*			_switch_profile_button = new EigoTestButtonItem()
            {
                MarginTop = button_size.Height / 3f,
                MarginLeft = button_left,
                Text = "Switch Profile",
                Color = button_color,
                BackColor = button_background_color,
                Size = button_size,
            };*/

            _quit_button = new EigoTestButtonItem()
            {
                MarginTop = button_size.Height / 3f,
                MarginLeft = button_left,
                Text = "終了する",
                Color = button_color,
                BackColor = button_background_color,
                Size = button_size,
                HelpText = "ゲームを終了してWindowsに戻ります。",
            };
            _quit_button.Click += (sender, e) =>
            {
                if (e.Info.Button != MouseButtons.Left) return;
                Window.QuitGame(this);
            };

            Items.Add(_start_game_button);

            var daimon = window.EPuzzleData.GetLastDaimon();
            if (null != daimon)
            {
                var continueButton = new EigoTestButtonItem()
                {
                    MarginTop = button_size.Height / 3f,
                    MarginLeft = button_left,
                    Text = "前回の続きから",
                    Name = "tsudukiKara",
                    Color = button_color,
                    BackColor = button_background_color,
                    Size = button_size,
                    HelpText = "最後にプレイしていた問題から再開します。",
                };
                Items.Add(continueButton);
            }

            if (mondaiDocumentIdsWhichAreUsedInTutorState.Any())
            {
                var tutorButton = new EigoTestButtonItem()
                {
                    MarginTop = button_size.Height / 3f,
                    MarginLeft = button_left,
                    Text = "復習する",
                    Name = "tutorButton",
                    Color = button_color,
                    BackColor = button_background_color,
                    Size = button_size,
                    HelpText = "復習が必要な問題を提案します。",
                };
                Items.Add(tutorButton);
            }

            //			Items.Add(_switch_profile_button);
            Items.Add(_quit_button);

            DrawingObjectRoot.BackColor = EPuzzleColors.Color00;

            Items.Add(CreateHelpTextBox());

            Action0 += (sender, e) =>
            {
                switch (CurrentItem.Name)
                {
                    case "tsudukiKara" :
                    {
                        if (null == daimon) throw new ApplicationException();
                        Window.State = WindowState.FoFi(this, new DaimonState(Window, daimon));
                        break;
                    }
                    case "tutorButton" :
                    {
                        Window.State = WindowState.FoFi(this, Window.GetTutorState(mondaiDocumentIdsWhichAreUsedInTutorState));
            //						Window.State = WindowState.FoFi(this, new TutorState(Window, mondaiDocumentIdsWhichAreUsedInTutorState));
                        break;
                    }
                    default :
                        break;
                }
            };
        }
 public EigoTestLabelItem CreateLabelToShowNumberOfQuestionsThatHaveBeenFinished()
 {
     var a = Window.EPuzzleData.CurrentUserInfo.MondaiResults.Count();
     var b = Window.EPuzzleData.CurrentUserInfo.GetMondaiResultsThatYouHaveDoneToday().Count();
     var c = Window.EPuzzleData.CurrentUserInfo.GetPlayTimeIgnoringDifficulty().TotalHours;
     var d = Window.EPuzzleData.GetQuestionsThatYouNeedToReview().Count();
     var e = Window.EPuzzleData.CurrentUserInfo.GetPlayTimeOfToday().TotalMinutes;
     var label = new EigoTestLabelItem()
     {
         Position = DrawingObjectPosition.Absolute,
         Color = Color.Black,
         Text = string.Format(
     @"プレイ回数: {0}
     総プレイ時間: {2:0.0}時間
     今日のプレイ回数: {1}
     今日のプレイ時間: {4:0.0}分
     要復習問題の数: {3}", a, b, c, d, e),
         Name = "kEB7",
         PaddingLeft = 10f,
         PaddingBottom = 10f,
         Width = 200f,
         Height = 100f,
         StringFormat = new StringFormat() { Alignment = StringAlignment.Near, LineAlignment = StringAlignment.Far, },
     };
     label.Left = DrawingObjectRoot.Left;
     label.Top = DrawingObjectRoot.Height - label.OuterHeight;
     return label;
 }