Example #1
0
        public SubConsoleCursor()
        {
            mainView = new Console(80, 23);
            subView  = new Console(mainView.GetSubSurface(new Rectangle(mainView.Width - 26, mainView.Height - 11, 25, 10)), mainView.Font);
            subView.Cursor.IsEnabled = true;

            UseKeyboard = true;

            // Setup main view
            mainView.FillWithRandomGarbage(mainView.Font);
            mainView.MouseMove += (s, e) => { if (e.Mouse.LeftButtonDown)
                                              {
                                                  e.Cell.Background = Color.Blue;
                                              }
            };

            // Setup sub view
            subView.Position          = new Point(4, 4);
            subView.DefaultBackground = Color.Black;
            subView.MouseMove        += (s, e) => { if (e.Mouse.LeftButtonDown)
                                                    {
                                                        e.Cell.Background = Color.Red;
                                                    }
            };
            subView.IsDirtyChanged += (s, e) => mainView.IsDirty = subView.IsDirty;
            subView.Clear();
            subView.Cursor.IsVisible = true;
            subView.Cursor
            .Print("The left-side box is a small console that uses a small area of the bottom-right of this whole console.")
            .CarriageReturn()
            .LineFeed();


            // Ad the consoles to the list.
            Children.Add(mainView);
            Children.Add(subView);

            IsVisible = false;
        }
Example #2
0
        public SubConsoleCursor()
        {
            mainView = new Console(80, 23);
            subView  = Console.FromSurface(mainView.GetSubSurface(new Rectangle(30, 4, 25, 10)), mainView.Font);

            UseKeyboard = true;

            // Setup main view
            mainView.FillWithRandomGarbage();
            mainView.MouseMove += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown)
                                              {
                                                  e.MouseState.Cell.Background = Color.Blue;
                                              }
            };

            // Setup sub view
            subView.Position          = new Point(4, 4);
            subView.DefaultBackground = Color.Black;
            subView.MouseMove        += (s, e) => { if (e.MouseState.Mouse.LeftButtonDown)
                                                    {
                                                        e.MouseState.Cell.Background = Color.Red;
                                                    }
            };
            subView.DirtyChanged += (s, e) => mainView.IsDirty = subView.IsDirty;
            subView.Clear();
            subView.Cursor.IsVisible = true;
            subView.Cursor
            .Print("The left box is a whole console which is a view into the box on the right.")
            .CarriageReturn()
            .LineFeed();


            // Ad the consoles to the list.
            Children.Add(mainView);
            Children.Add(subView);

            IsVisible = false;
        }