Exemple #1
0
        public Popup(GuiComponent parent, string message)
        {
            var titled = new TitledWindow(parent, "About...")
            {
                BackGround = ConsoleColor.DarkBlue,
                Foreground = ConsoleColor.White
            };

            var label = new TextLabel(titled, message, new Coord(4, 1));

            titled.Dimensions = label.GetSize();
            titled.Dimensions.Height.Pixels += 5;
            titled.Dimensions.Width.Pixels  += 6;
            titled.Position = new Coord((State.MaxX - titled.Dimensions.Width.Pixels) / 2,
                                        ((State.MaxY - titled.Dimensions.Height.Pixels) / 2) - 1);

            label.AdjustWhenParentsReposition();

            var screenCenter = new Coord(titled.Dimensions.Width.Pixels / 2, label.Height + 2);
            var ok           = new Button(titled, "OK", () => { titled.RemoveMeAndChildren(); }, screenCenter)
            {
                BackGround = ConsoleColor.DarkGray,
                Foreground = ConsoleColor.Green
            };

            ok.Focus();
        }
Exemple #2
0
        public PopupNoButton(GuiComponent parent, string message) : base(parent)
        {
            var label = new TextLabel(this, message, new Coord(0, 4))
            {
                BackGround = ConsoleColor.Black
            };

            Dimensions = label.GetSize();
            Dimensions.Width.Pixels += 6;

            Position = new Coord((State.MaxX - Dimensions.Width.Pixels) / 2, ((State.MaxY - Dimensions.Height.Pixels) / 2) - 1);
            label.AdjustWhenParentsReposition();
            this.Focus();
        }