示例#1
0
        public void Print()
        {
            int alignX = 0;
            int temp;

            switch (alignment)
            {
            case Alignment.LeftAligned:
                GraphicRenderer.PrintBorder(new Border(new XYPair(width, height), new XYPair(spacing, y)));
                break;

            case Alignment.Centered:
                temp   = (Console.WindowWidth - width) / 2 - 1;
                alignX = temp > 0? temp : 0;
                GraphicRenderer.PrintBorder(new Border(new XYPair(width, height), new XYPair(alignX, y)));
                break;

            case Alignment.RightAligned:
                temp   = (Console.WindowWidth - width) - spacing - 1;
                alignX = temp > 0 ? temp : 0;
                GraphicRenderer.PrintBorder(new Border(new XYPair(width, height), new XYPair(alignX, y)));
                break;

            case Alignment.Free:
                GraphicRenderer.PrintBorder(new Border(new XYPair(width, height), new XYPair(x, y)));
                break;

            default:
                break;
            }
            Console.CursorVisible = false;
        }
示例#2
0
        public void Print(XYPair position, string imageName)
        {
            int index = images.FindIndex(f => f.name == imageName);

            if (index >= 0)
            {
                Image imageSelected = images[index];
                GraphicRenderer.PrintImage(position, imageSelected);
            }
            else
            {
                StringRenderer.PrintFreeString(new FreeString(new XYPair(position.x, position.y),
                                                              $"Image: {imageName} not find", TextColor.Red, alignment: Alignment.LeftAligned));
            }
        }