Exemplo n.º 1
0
 public static void DrawRectangle(MRectangle rec, CColor color)
 {
     SetCursor(rec.From);
     for (int i = 0; i <= rec.Height; ++i)
     {
         DrawStringInPoint(LastPoint(), color, "".PadLeft(rec.Width + 1));
         SetCursor(MoveCursorFromLastY(1));
     }
 }
Exemplo n.º 2
0
        public static void DrawRectangleBorder(MRectangle rec, CColor color)
        {
            SetCursor(rec.From);
            MPoint leftBottom = MoveCursorFromLastY(rec.Height);
            MPoint rightTop   = MoveCursorFromLastX(rec.Width);

            DrawStringInPoint(rec.From, color, "".PadLeft(rec.Width));
            DrawStringInPoint(leftBottom, color, "".PadLeft(rec.Width));
            DrawLine(rec.From, leftBottom, color);
            DrawLine(rec.To, rightTop, color);
        }
Exemplo n.º 3
0
        private static void DrawLine(int x0, int y0, int x1, int y1, CColor color)
        {
            bool steep = false;

            if (Math.Abs(x0 - x1) < Math.Abs(y0 - y1))
            {
                Swap(ref x0, ref y0);
                Swap(ref x1, ref y1);
                steep = true;
            }
            if (x0 > x1)
            {
                Swap(ref x0, ref x1);
                Swap(ref y0, ref y1);
            }
            int dx      = x1 - x0;
            int dy      = y1 - y0;
            int derror2 = Math.Abs(dy) * 2;
            int error2  = 0;
            int y       = y0;

            for (int x = x0; x <= x1; x++)
            {
                if (steep)
                {
                    DrawPoint(y, x, color);
                }
                else
                {
                    DrawPoint(x, y, color);
                }
                error2 += derror2;

                if (error2 > dx)
                {
                    y      += (y1 > y0 ? 1 : -1);
                    error2 -= dx * 2;
                }
            }
        }
Exemplo n.º 4
0
 public static void DrawLine(MPoint from, MPoint to, CColor color)
 {
     DrawLine(from.x, from.y, to.x, to.y, color);
 }
Exemplo n.º 5
0
 public static void DrawRectangle(int x, int y, int width, int height, CColor color)
 {
     DrawRectangle(x, y, width, height, color);
 }
Exemplo n.º 6
0
 public static void DrawRectangle(MPoint from, MPoint to, CColor color)
 {
     DrawRectangle(new MRectangle(from, to), color);
 }
Exemplo n.º 7
0
 public static void DrawRectangle(MPoint where, int width, int height, CColor color)
 {
     DrawRectangle(new MRectangle(where, width, height), color);
 }
Exemplo n.º 8
0
 public static void DrawStringInPoint(MPoint where, CColor c, String S)
 {
     SetCursor(where.x, where.y);
     c.Apply();
     Console.Write(S);
 }
Exemplo n.º 9
0
 public static void DrawStringInPoint(MPoint where, CColor c, String S, int maxSymbols)
 {
     SetCursor(where.x, where.y);
     c.Apply();
     Console.Write(Short(S, maxSymbols));
 }
Exemplo n.º 10
0
 public static void DrawStringInPoint(int x, int y, CColor c, String S)
 {
     SetCursor(x, y);
     c.Apply();
     Console.Write(S);
 }
Exemplo n.º 11
0
 public static void DrawPoint(int x, int y, CColor c)
 {
     DrawStringInPoint(x, y, c, " ");
 }
Exemplo n.º 12
0
 public virtual void setLockColor(CColor c)
 {
     lockColor = c;
 }
Exemplo n.º 13
0
 public virtual void setMainColor(CColor c)
 {
     mainColor = c;
 }
Exemplo n.º 14
0
 public void setDefaultColors()
 {
     mainColor = new CColor(ConsoleColor.White, ConsoleColor.Black);
     lockColor = new CColor(ConsoleColor.Gray, ConsoleColor.DarkGray);
 }