示例#1
0
 static void Painter_MouseMove(object sender, PainterMouseEventArgs e)
 {
     if (penOn)
     {
         paintBuffer.DrawLine(pLast.X, pLast.Y, e.UnitLocation.X, e.UnitLocation.Y, pallette[pen]);
     }
     pLast = e.UnitLocation;
 }
        public void DrawLine()
        {
            var buffer = new ConsoleBuffer(3);

            buffer.DrawLine(Line.Vertical(1, 0, 3), Red, LineWidth.Single, DrawLineFlags.CapFull);
            buffer.DrawLine(Line.Horizontal(0, 1, 3), Green, LineWidth.Double, DrawLineFlags.CapFull);

            var c0 = new ConsoleChar();
            var cr = new ConsoleChar {
                LineChar = LineCharVertical, ForegroundColor = Red
            };
            var cg = new ConsoleChar {
                LineChar = LineCharHorizontalDouble, ForegroundColor = Green
            };
            var cx = new ConsoleChar {
                LineChar = LineCharHorizontalDoubleVertical, ForegroundColor = Green
            };

            buffer.GetLine(0).Should().Equal(c0, cr, c0);
            buffer.GetLine(1).Should().Equal(cg, cx, cg);
            buffer.GetLine(2).Should().Equal(c0, cr, c0);
        }
示例#3
0
        public void DrawLine()
        {
            var buffer = new ConsoleBuffer(3);

            buffer.DrawLine(Line.Vertical(1, 0, 3), Red);
            buffer.DrawLine(Line.Horizontal(0, 1, 3), Green, LineWidth.Wide);

            var c0 = new ConsoleChar();
            var cr = new ConsoleChar {
                LineChar = LineChar.Vertical, ForegroundColor = Red
            };
            var cg = new ConsoleChar {
                LineChar = LineChar.Horizontal | LineChar.HorizontalWide, ForegroundColor = Green
            };
            var cx = new ConsoleChar {
                LineChar = LineChar.Horizontal | LineChar.HorizontalWide | LineChar.Vertical, ForegroundColor = Green
            };

            buffer.GetLine(0).Should().Equal(c0, cr, c0);
            buffer.GetLine(1).Should().Equal(cg, cx, cg);
            buffer.GetLine(2).Should().Equal(c0, cr, c0);
        }
        public void DrawLine ()
        {
            var buffer = new ConsoleBuffer(3);

            buffer.DrawLine(Line.Vertical(1, 0, 3), Red);
            buffer.DrawLine(Line.Horizontal(0, 1, 3), Green, LineWidth.Wide);

            var c0 = new ConsoleChar();
            var cr = new ConsoleChar { LineChar = LineChar.Vertical, ForegroundColor = Red };
            var cg = new ConsoleChar { LineChar = LineChar.Horizontal | LineChar.HorizontalWide, ForegroundColor = Green };
            var cx = new ConsoleChar { LineChar = LineChar.Horizontal | LineChar.HorizontalWide | LineChar.Vertical, ForegroundColor = Green };

            buffer.GetLine(0).Should().Equal(c0, cr, c0);
            buffer.GetLine(1).Should().Equal(cg, cx, cg);
            buffer.GetLine(2).Should().Equal(c0, cr, c0);
        }