Пример #1
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            ScrollableContent.Paint();

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    int scrollX = x + HorizontalScrollUnits;
                    int scrollY = y + VerticalScrollUnits;

                    if (scrollX >= ScrollableContent.Width || scrollY >= ScrollableContent.Height)
                    {
                        continue;
                    }

                    var scrolledPixel = ScrollableContent.Bitmap.GetPixel(scrollX, scrollY);

                    if (scrolledPixel.Value.HasValue)
                    {
                        context.Pen = scrolledPixel.Value.Value;
                    }
                    else
                    {
                        context.Pen = new ConsoleCharacter(' ', backgroundColor: Background);
                    }

                    context.DrawPoint(x, y);
                }
            }
        }
Пример #2
0
        protected override void OnPaint(ConsoleBitmap context)
        {
            ScrollableContent.Paint();

            for (int x = 0; x < Width; x++)
            {
                for (int y = 0; y < Height; y++)
                {
                    int scrollX = x + HorizontalScrollUnits;
                    int scrollY = y + VerticalScrollUnits;

                    if (scrollX >= ScrollableContent.Width || scrollY >= ScrollableContent.Height)
                    {
                        continue;
                    }

                    var scrolledPixel = ScrollableContent.Bitmap.GetPixel(scrollX, scrollY);
                    context.DrawPoint(scrolledPixel, x, y);
                }
            }

            verticalScrollbar.Paint();
            horizontalScrollbar.Paint();
            DrawScrollbar(verticalScrollbar, context);
            DrawScrollbar(horizontalScrollbar, context);
        }