示例#1
0
        public ScrollingConsole(int width, int height, int bufferHeight, Font font = null)
        {
            UseKeyboard   = false;
            UseMouse      = true;
            _controlsHost = new ControlsConsole(1, height);

            var borderSurface = new Basic(width + 2, height + 2, Font);

            borderSurface.DrawBox(new Rectangle(0, 0, borderSurface.Width, borderSurface.Height),
                                  new Cell(Color.DarkCyan, Color.Black), null, ConnectedLineThick);
            borderSurface.Position = new Point(-1, -1);
            Children.Add(borderSurface);

            _mainConsole = new Console(width - 1, bufferHeight)
            {
                ViewPort = new Rectangle(0, 0, width - 1, height),
                Cursor   = { IsVisible = false },
                Font     = font == null ? Font:font
            };

            _scrollBar               = ScrollBar.Create(Orientation.Vertical, height);
            _scrollBar.IsEnabled     = false;
            _scrollBar.ValueChanged += ScrollBar_ValueChanged;

            _controlsHost.Add(_scrollBar);
            _controlsHost.Position = new Point(1 + _mainConsole.Width, Position.Y);

            Children.Add(_mainConsole);
            Children.Add(_controlsHost);

            _scrollingCounter = 0;
        }
示例#2
0
        public CharacterViewer()
            : base(27, 20)
        {
            //DefaultShowLocation = StartupLocation.CenterScreen;
            //Fill(Color.White, Color.Black, 0, null);
            Title          = (char)198 + "Character" + (char)198;
            TitleAlignment = System.Windows.HorizontalAlignment.Left;
            //SetTitle(" Characters ", System.Windows.HorizontalAlignment.Center, Color.Blue, Color.LightGray);
            CloseOnESC          = true;
            UsePixelPositioning = true;

            // CHARACTER SCROLL
            _charScrollBar               = ScrollBar.Create(System.Windows.Controls.Orientation.Vertical, 16);
            _charScrollBar.Position      = new Point(17, 1);
            _charScrollBar.Name          = "ScrollBar";
            _charScrollBar.Maximum       = textSurface.Font.Rows - 16;
            _charScrollBar.Value         = 0;
            _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged);
            _charScrollBar.IsEnabled     = textSurface.Font.Rows > 16;

            // Add all controls
            this.Add(_charScrollBar);

            _closeButton = new Button(6)
            {
                Text = "Ok", Position = new Point(19, 1)
            }; Add(_closeButton); _closeButton.Click += (sender, e) => { DialogResult = true; Hide(); };

            // Effects
            highlightedEffect            = new Recolor();
            highlightedEffect.Foreground = Color.Blue;
            highlightedEffect.Background = Color.DarkGray;

            unhighlightEffect = new SadConsole.Effects.Fade()
            {
                FadeBackground        = true,
                FadeForeground        = true,
                DestinationForeground = new ColorGradient(highlightedEffect.Foreground, Color.White),
                DestinationBackground = new ColorGradient(highlightedEffect.Background, Color.Black),
                FadeDuration          = 0.3d,
                RemoveOnFinished      = true,
                UseCellBackground     = false,
                UseCellForeground     = false,
                CloneOnApply          = true,
                Permanent             = true
            };

            // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it
            Redraw();
        }
示例#3
0
        public CharacterViewer()
            : base(27, 20)
        {
            //DefaultShowLocation = StartupLocation.CenterScreen;
            //Fill(Color.White, Color.Black, 0, null);
            Title          = (char)198 + "Character" + (char)198;
            TitleAlignment = System.Windows.HorizontalAlignment.Left;
            //SetTitle(" Characters ", System.Windows.HorizontalAlignment.Center, Color.Blue, Color.LightGray);
            CloseOnESC = true;

            // CHARACTER SCROLL
            _charScrollBar               = ScrollBar.Create(System.Windows.Controls.Orientation.Vertical, 16);
            _charScrollBar.Position      = new Point(17, 1);
            _charScrollBar.Name          = "ScrollBar";
            _charScrollBar.Maximum       = textSurface.Font.Rows - 16;
            _charScrollBar.Value         = 0;
            _charScrollBar.ValueChanged += new EventHandler(_charScrollBar_ValueChanged);
            _charScrollBar.IsEnabled     = textSurface.Font.Rows > 16;

            // Effects
            effects = new EffectsManager(textSurface);

            // Add all controls
            this.Add(_charScrollBar);

            _closeButton = new Button(6)
            {
                Text = "Ok", Position = new Point(19, 1)
            }; Add(_closeButton); _closeButton.Click += (sender, e) => { DialogResult = true; Hide(); };

            _highlightedCellEffect.Foreground = Color.Blue;
            _highlightedCellEffect.Background = ColorHelper.DarkGray;

            // The frame will have been drawn by the base class, so redraw and our close button will be put on top of it
            Redraw();
        }