示例#1
0
        public override void DrawLine(BitmapWrap bmp, int x1, int y1, int x2, int y2, bool drawFirstDot = false)
        {
            PathCalculator           lineCalc = new PathCalculator();
            List <Tuple <int, int> > dotList  = lineCalc.CalculateLinePath(x1, y1, x2, y2);

            if (drawFirstDot)
            {
                DrawDot(bmp, dotList[0].Item1, dotList[0].Item2);
            }

            for (int i = 1; i < dotList.Count; i++)
            {
                if (dotList[i].Item1 < dotList[i - 1].Item1)
                {
                    DrawDotBorder(bmp, dotList[i].Item1, dotList[i].Item2, Direction.Left);
                }
                if (dotList[i].Item1 > dotList[i - 1].Item1)
                {
                    DrawDotBorder(bmp, dotList[i].Item1, dotList[i].Item2, Direction.Right);
                }
                if (dotList[i].Item2 < dotList[i - 1].Item2)
                {
                    DrawDotBorder(bmp, dotList[i].Item1, dotList[i].Item2, Direction.Up);
                }
                if (dotList[i].Item2 > dotList[i - 1].Item2)
                {
                    DrawDotBorder(bmp, dotList[i].Item1, dotList[i].Item2, Direction.Down);
                }
            }
        }
示例#2
0
        public override void DrawLine(BitmapWrap bmp, int x1, int y1, int x2, int y2, bool drawFirstDot = false)
        {
            PathCalculator           lineCalc = new PathCalculator();
            List <Tuple <int, int> > dotList  = lineCalc.CalculateLinePath(x1, y1, x2, y2);

            if (drawFirstDot)
            {
                DrawDot(bmp, dotList[0].Item1, dotList[0].Item2);
            }

            for (int i = 1; i < dotList.Count; i++)
            {
                DrawBorder(bmp, dotList[i].Item1, dotList[i].Item2);
            }
        }