示例#1
0
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;
                Path p = buildShape(data);

                r = data.state.colorR;
                g = data.state.colorG;
                b = data.state.colorB;

                p.Stroke          = new SolidColorBrush(System.Windows.Media.Color.FromRgb(r, g, b));
                p.StrokeThickness = shapeLib.Data.strokeT;
                // p.StrokeEndLineCap = PenLineCap.Round;
                // p.StrokeStartLineCap = PenLineCap.Flat;
                shapeLib.Data.mygrid.Children.Add(p);
                gv.baseShape.Add(p);

                Debug.WriteLine("draw pencil");
            }
            else
            {
                Path myLine = (Path)gv.baseShape[0];

                buildShape(data, myLine);
            }


            //shapeLib.Data.mygrid.MouseDown += new System.Windows.Input.MouseButtonEventHandler(LeftButtonDown);
        }
示例#2
0
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;

                Rectangle myRect = new Rectangle();

                //如果要繪製中心顏色,可開啟這段
                myRect.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));
                myRect.Width  = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
                myRect.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
                myRect.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
                myRect.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
                myRect.VerticalAlignment    = VerticalAlignment.Center;
                myRect.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myRect.MouseEnter          += data.myLine_MouseEnter;
                myRect.MouseLeave          += data.myLine_MouseLeave;
                myRect.StrokeThickness      = shapeLib.Data.strokeT;
                myRect.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                shapeLib.Data.mygrid.Children.Add(myRect);
                gv.baseShape.Add(myRect);
            }
            else
            {
                Rectangle myRect = (Rectangle)gv.baseShape[0];// =(Line) currPath.getDrawShape();
                myRect.Width  = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
                myRect.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
                myRect.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
            }


            //   throw new NotImplementedException();
        }
示例#3
0
 public override void DisplayControlPoints(gView gv, gPath data)
 {
     if (gv.controlShape.Count == 0)
     {
         Rectangle myRect = new Rectangle();
         myRect.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 0, 0));
         myRect.Width  = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
         myRect.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
         myRect.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
         myRect.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
         myRect.VerticalAlignment    = VerticalAlignment.Center;
         myRect.StrokeThickness      = shapeLib.Data.strokeT;
         myRect.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
         myRect.MouseEnter          += data.myLine_MouseEnter;
         myRect.MouseLeave          += data.myLine_MouseLeave;
         shapeLib.Data.mygrid.Children.Add(myRect);
         gv.controlShape.Add(myRect);
     }
     else
     {
         Rectangle myRect = (Rectangle)gv.controlShape[0];
         myRect.Width  = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
         myRect.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
         myRect.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
     }
 }
示例#4
0
        public virtual void DisplayControlPoints(gView gv, gPath data)
        {
            if (gv.controlShape.Count == 0)
            {
                Line myLine = new Line();
                myLine.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(0, 255, 0));
                myLine.X1     = data.controlBtn1.X;
                myLine.Y1     = data.controlBtn1.Y;
                myLine.X2     = data.controlBtn4.X;
                myLine.Y2     = data.controlBtn4.Y;
                myLine.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
                myLine.VerticalAlignment    = VerticalAlignment.Center;
                myLine.StrokeThickness      = shapeLib.Data.strokeT;
                myLine.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myLine.MouseEnter          += data.myLine_MouseEnter;
                myLine.MouseLeave          += data.myLine_MouseLeave;
                shapeLib.Data.mygrid.Children.Add(myLine);
                gv.controlShape.Add(myLine);
            }
            else
            {
                Line myLine = (Line)gv.controlShape[0];// =(Line) currPath.getDrawShape();

                myLine.X1 = data.controlBtn1.X;
                myLine.Y1 = data.controlBtn1.Y;
                myLine.X2 = data.controlBtn4.X;
                myLine.Y2 = data.controlBtn4.Y;
            }


            // throw new NotImplementedException();
        }
示例#5
0
文件: GraphDoc.cs 项目: toreal/Violet
        /// <summary>
        ///
        /// </summary>
        /// <param name="remove"> -1 : 移除, 0: 運動中畫, 1: 正式畫 , 2: 重新加入</param>
        public void redraw(int removetype)
        {
            gView   gv     = null;
            Boolean bfirst = false;

            if (shapeIndex < 0)
            {
                gv         = new gView();
                shapeIndex = shapeLib.Data.gdc.shapeList.Count;
                shapeLib.Data.gdc.shapeList.Add(gv);
                bfirst = true;
            }
            else
            {
                gv = shapeLib.Data.gdc.shapeList[shapeIndex];
            }


            if (isSel)
            {
                foreach (Shape sp in gv.baseShape)
                {
                    shapeLib.Data.mygrid.Children.Remove(sp);
                }
                shapeLib.SupportedShape(null)[drawtype].DisplayControlPoints(gv, this);
            }
            else
            {
                foreach (Shape sp in gv.controlShape)
                {
                    shapeLib.Data.mygrid.Children.Remove(sp);
                }
                gv.controlShape.Clear();

                switch (removetype)
                {
                case -1:
                    foreach (Shape sp in gv.baseShape)
                    {
                        shapeLib.Data.mygrid.Children.Remove(sp);
                    }
                    break;


                case 2:
                    foreach (Shape sp in gv.baseShape)
                    {
                        shapeLib.Data.mygrid.Children.Add(sp);
                    }
                    shapeLib.SupportedShape(null)[drawtype].DrawShape(gv, this, bfirst);
                    break;

                case 0:
                case 1:
                    shapeLib.SupportedShape(null)[drawtype].DrawShape(gv, this, bfirst);

                    break;
                }
            }
        }
示例#6
0
        public override void DisplayControlPoints(gView gv, gPath data)
        {
            if (gv.controlShape.Count == 0)
            {
                Polyline myTri = new Polyline();

                //        //如果要繪製中心顏色,可開啟這段
                myTri.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 255, 0));
                PointCollection Points = new PointCollection();
                Points.Add(new System.Windows.Point(data.controlBtn1.X + (data.controlBtn4.X - data.controlBtn1.X) / 2, data.controlBtn1.Y));
                Points.Add(new System.Windows.Point(data.controlBtn1.X, data.controlBtn4.Y));
                Points.Add(new System.Windows.Point(data.controlBtn4.X, data.controlBtn4.Y));
                Points.Add(new System.Windows.Point(data.controlBtn1.X + (data.controlBtn4.X - data.controlBtn1.X) / 2, data.controlBtn1.Y));
                myTri.Points = new PointCollection(Points);
                myTri.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
                myTri.VerticalAlignment    = VerticalAlignment.Center;
                myTri.StrokeThickness      = shapeLib.Data.strokeT;
                myTri.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myTri.MouseEnter          += data.myLine_MouseEnter;
                myTri.MouseLeave          += data.myLine_MouseLeave;
                shapeLib.Data.mygrid.Children.Add(myTri);
                gv.controlShape.Add(myTri);
            }

            else
            {
                Polyline        myTri  = (Polyline)gv.controlShape[0];// =(Line) currPath.getDrawShape();
                PointCollection Points = new PointCollection();
                Points.Add(new System.Windows.Point(data.controlBtn1.X + (data.controlBtn4.X - data.controlBtn1.X) / 2, data.controlBtn1.Y));
                Points.Add(new System.Windows.Point(data.controlBtn1.X, data.controlBtn4.Y));
                Points.Add(new System.Windows.Point(data.controlBtn4.X, data.controlBtn4.Y));
                Points.Add(new System.Windows.Point(data.controlBtn1.X + (data.controlBtn4.X - data.controlBtn1.X) / 2, data.controlBtn1.Y));
                myTri.Points = new PointCollection(Points);
            }
        }
示例#7
0
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;

                Shape myEllipse;
                if (Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift))
                {
                    Path            mypath = new Path();
                    EllipseGeometry mye    = new EllipseGeometry();
                    mye.Center  = data.controlBtn1;
                    mypath.Data = mye;


                    myEllipse = mypath;
                }
                else
                {
                    myEllipse = new Ellipse();
                    // Create a SolidColorBrush with a red color to fill the
                    // Ellipse with.

                    // Set the width and height of the Ellipse.
                    myEllipse.Width  = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
                    myEllipse.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
                    myEllipse.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
                }

                myEllipse.Stroke = new SolidColorBrush(Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));
                myEllipse.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myEllipse.MouseEnter          += data.myLine_MouseEnter;
                myEllipse.MouseLeave          += data.myLine_MouseLeave;
                shapeLib.Data.mygrid.Children.Add(myEllipse);
                gv.baseShape.Add(myEllipse);
            }
            else
            {
                Shape myEllipse = (Shape)gv.baseShape[0];

                if (myEllipse is Ellipse)
                {
                    myEllipse.Width  = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
                    myEllipse.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
                    myEllipse.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
                }
                else
                {
                    Path            myp  = (Path)gv.baseShape[0];
                    EllipseGeometry myre = (EllipseGeometry)myp.Data;
                    myre.RadiusX = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
                    myre.RadiusY = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
                }
            }
        }
示例#8
0
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;

                Polygon myTri = new Polygon();

                //        //如果要繪製中心顏色,可開啟這段
                SolidColorBrush mySolidColorBrush = new SolidColorBrush();
                myTri.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));
                PointCollection Points = new PointCollection();
                Points.Add(data.controlBtn1);
                Points.Add(data.controlBtn3);
                Points.Add(data.controlBtn4);
                // Points.Add(data.controlBtn1);


                myTri.Points = new PointCollection(Points);
                myTri.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
                myTri.VerticalAlignment    = VerticalAlignment.Center;
                myTri.StrokeThickness      = shapeLib.Data.strokeT;
                myTri.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myTri.MouseEnter          += data.myLine_MouseEnter;
                myTri.MouseLeave          += data.myLine_MouseLeave;
                shapeLib.Data.mygrid.Children.Add(myTri);
                gv.baseShape.Add(myTri);
            }
            else
            {
                Polygon         myTri  = (Polygon)gv.baseShape[0];// =(Line) currPath.getDrawShape();
                PointCollection Points = new PointCollection();
                Points.Add(data.controlBtn1);
                Points.Add(data.controlBtn3);
                Points.Add(data.controlBtn4);
                //   Points.Add(data.controlBtn1);
                myTri.Points = new PointCollection(Points);
            }


            //   throw new NotImplementedException();
        }
示例#9
0
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;
                BezierSegment bezier = new BezierSegment();
                bezier.Point3 = data.controlBtn3;
                PathFigure figure = new PathFigure();
                figure.StartPoint = data.controlBtn1;
                bezier.Point1     = figure.StartPoint;
                bezier.Point2     = bezier.Point3;
                figure.Segments.Add(bezier);
                PathGeometry geometry = new PathGeometry();
                geometry.Figures.Add(figure);
                Path            myPath            = new System.Windows.Shapes.Path();
                SolidColorBrush mySolidColorBrush = new SolidColorBrush();
                // Describes the brush's color using RGB values.
                // Each value has a range of 0-255.

                myPath.Stroke          = new SolidColorBrush(Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));
                myPath.StrokeThickness = data.state.strokeT;

                /*myPath.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                 * myPath.MouseEnter += data.myLine_MouseEnter;
                 * myPath.MouseLeave += data.myLine_MouseLeave; */
                myPath.Data = geometry;
                shapeLib.Data.mygrid.Children.Add(myPath);
                gv.baseShape.Add(myPath);
            }
            else
            {
                Path         myPath   = (Path)gv.baseShape[0];// =(Line) currPath.getDrawShape();
                PathGeometry geometry = (PathGeometry)myPath.Data;
                geometry.Figures[0].StartPoint = data.controlBtn1;
                BezierSegment bs = (BezierSegment)geometry.Figures[0].Segments[0];
                bs.Point1 = data.controlBtn2;
                bs.Point2 = data.controlBtn3;
                bs.Point3 = data.controlBtn4;
            }
        }
示例#10
0
        //依data 繪製,如果是第一次畫要新建shape, 更新的話只要更新最後一點
        public virtual void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;

                Line myLine = new Line();
                myLine.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));

                myLine.X1 = data.controlBtn1.X;
                myLine.Y1 = data.controlBtn1.Y;
                myLine.X2 = data.controlBtn4.X;
                myLine.Y2 = data.controlBtn4.Y;
                myLine.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
                myLine.VerticalAlignment    = VerticalAlignment.Center;
                myLine.StrokeThickness      = shapeLib.Data.strokeT;
                myLine.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myLine.MouseEnter          += data.myLine_MouseEnter;
                myLine.MouseLeave          += data.myLine_MouseLeave;
                shapeLib.Data.mygrid.Children.Add(myLine);
                gv.baseShape.Add(myLine);
                // currPath.setDrawShape( myLine);
            }
            else
            {
                Line myLine = (Line)gv.baseShape[0];// =(Line) currPath.getDrawShape();

                myLine.X1 = data.controlBtn1.X;
                myLine.Y1 = data.controlBtn1.Y;


                myLine.X2 = data.controlBtn4.X;
                myLine.Y2 = data.controlBtn4.Y;
            }


            //   throw new NotImplementedException();
        }
示例#11
0
        //public void RightButtonDown(object sender, MouseButtonEventArgs e)
        //{
        //    shapeLib.Data.mygrid.Children.Remove(textBox);

        //}

        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;

                if (txt == null)
                {
                    x = data.controlBtn1.X;
                    y = data.controlBtn1.Y;
                    r = data.state.colorR;
                    g = data.state.colorG;
                    b = data.state.colorB;
                    textBox.Foreground = new SolidColorBrush(System.Windows.Media.Color.FromRgb(r, g, b));
                    Canvas.SetLeft(textBox, x);
                    Canvas.SetTop(textBox, y);
                    textBox.FontSize = 10 + shapeLib.Data.strokeT * 4;
                    shapeLib.Data.mygrid.Children.Add(textBox);
                    textBox.Focus();
                    textBox.AcceptsReturn = true;
                    textBox.AcceptsTab    = true;
                    txt  = textBox.Text;
                    last = false;
                    // shapeLib.Data.mygrid.MouseDown += this.MouseDownInsert;
                    //new System.Windows.Input.MouseButtonEventHandler(LeftButtonDown);
                }
                else if (!last)
                {
                    txt = null;
                    textBox.Focus();
                }
            }
            else
            {
                txt = null;
            }
        }
示例#12
0
        public override void DisplayControlPoints(gView gv, gPath data)
        {
            if (gv.controlShape.Count == 0)
            {
                BezierSegment bezier = new BezierSegment();
                bezier.Point3 = data.controlBtn3;
                PathFigure figure = new PathFigure();
                figure.StartPoint = data.controlBtn1;
                bezier.Point1     = figure.StartPoint;
                bezier.Point2     = bezier.Point3;
                figure.Segments.Add(bezier);
                PathGeometry geometry = new PathGeometry();
                geometry.Figures.Add(figure);
                Path myPath = new System.Windows.Shapes.Path();
                myPath.Stroke          = new SolidColorBrush(System.Windows.Media.Color.FromRgb(255, 0, 255));
                myPath.StrokeThickness = data.state.strokeT;

                /* myPath.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                 * myPath.MouseEnter += data.myLine_MouseEnter;
                 * myPath.MouseLeave += data.myLine_MouseLeave;  */
                myPath.Data = geometry;
                shapeLib.Data.mygrid.Children.Add(myPath);
                gv.controlShape.Add(myPath);
            }

            else
            {
                Path         myPath   = (Path)gv.controlShape[0];// =(Line) currPath.getDrawShape();
                PathGeometry geometry = (PathGeometry)myPath.Data;
                geometry.Figures[0].StartPoint = data.controlBtn1;
                BezierSegment bs = (BezierSegment)geometry.Figures[0].Segments[0];
                bs.Point1 = data.controlBtn2;
                bs.Point2 = data.controlBtn3;
                bs.Point3 = data.controlBtn4;
            }
        }
示例#13
0
文件: eraser.cs 项目: toreal/Violet
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (count == 0)
            {
                myarr[3] = data.controlBtn1;
                Path         myPath   = new System.Windows.Shapes.Path();
                PathGeometry geometry = (PathGeometry)myPath.Data;
                shapeLib.Data.mygrid.Children.Add(myPath);
                gv.baseShape.Add(myPath);
                count++;
            }
            else
            {
                if (bfirst)
                {
                    shapeLib.Data.Status = "rest";
                    shapeLib.Data.bfirst = false;
                    BezierSegment bezier = new BezierSegment();
                    PathFigure    figure = new PathFigure();



                    for (int a = 0; a < 4; a++)
                    {
                        if ((3 - a) > 0)
                        {
                            myarr[2 - a] = myarr[3 - a];
                        }
                        else
                        {
                            myarr[a] = data.controlBtn1;
                        }
                    }

                    for (int i = 0; i < m - 3; i++)
                    {
                        if (i == m - 4)
                        {
                            extra = 1;
                        }
                        else
                        {
                            extra = 0;
                        }
                        for (int j = 0; j < MAX_STEPS + extra; j++)
                        {
                            double u  = j / MAX_STEPS;
                            double Qx = B0(u) * myarr[i].X +
                                        B1(u) * myarr[i + 1].X +
                                        B2(u) * myarr[i + 2].X +
                                        B3(u) * myarr[i + 3].X;

                            double Qy = B0(u) * myarr[i].Y +
                                        B1(u) * myarr[i + 1].Y +
                                        B2(u) * myarr[i + 2].Y +
                                        B3(u) * myarr[i + 3].Y;

                            myarr[i].X = Qx;
                            myarr[i].Y = Qy;
                        }
                    }
                    //figure.StartPoint = myarr[0];
                    //bezier.Point1 = myarr[1];
                    //bezier.Point2 = data.controlBtn4;
                    //bezier.Point3 = myarr[3];

                    figure.Segments.Add(bezier);
                    PathGeometry geometry = new PathGeometry();
                    geometry.Figures.Add(figure);

                    //myPath.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(curve_MouseLeftButtonDown);
                    SolidColorBrush mySolidColorBrush = new SolidColorBrush();
                    // Describes the brush's color using RGB values.
                    // Each value has a range of 0-255.

                    Path myPath = new System.Windows.Shapes.Path();
                    myPath.Stroke          = new SolidColorBrush(Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));
                    myPath.StrokeThickness = data.state.strokeT;

                    /*myPath.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                     * myPath.MouseEnter += data.myLine_MouseEnter;
                     * myPath.MouseLeave += data.myLine_MouseLeave; */
                    myPath.Data = geometry;
                    shapeLib.Data.mygrid.Children.Add(myPath);
                    gv.baseShape.Add(myPath);
                }
                else
                {
                    Path         myPath   = (Path)gv.baseShape[0];// =(Line) currPath.getDrawShape();
                    PathGeometry geometry = (PathGeometry)myPath.Data;
                    if (geometry != null)
                    {
                        BezierSegment bs = (BezierSegment)geometry.Figures[0].Segments[0];

                        geometry.Figures[0].StartPoint = myarr[0];
                        bs.Point1 = myarr[1];
                        bs.Point2 = data.controlBtn4;
                        bs.Point3 = myarr[3];
                    }
                }
            }
        }
示例#14
0
        public override void DrawShape(gView gv, gPath data, Boolean bfirst)
        {
            if (bfirst)
            {
                shapeLib.Data.Status = "rest";
                shapeLib.Data.bfirst = false;

                double num1   = Math.Atan2((data.controlBtn4.X - data.controlBtn1.X), (data.controlBtn4.Y - data.controlBtn1.Y));
                double num2   = 0.5;
                double num3   = 6.0;
                Point  point1 = new Point();
                Point  point2 = new Point();
                Point  point3 = new Point();
                point1.X = data.controlBtn4.X - ((num3 * Math.Sin(num1 - num2)));
                point1.Y = data.controlBtn4.Y - ((num3 * Math.Cos(num1 - num2)));
                point2.X = data.controlBtn4.X - ((num3 * Math.Sin(num1 + num2)));
                point2.Y = data.controlBtn4.Y - ((num3 * Math.Cos(num1 + num2)));
                point3.X = point1.X - (point1.X - point2.X) / 2;
                point3.Y = point1.Y - (point1.Y - point2.Y) / 2;
                Polyline myArr = new Polyline();

                //        //如果要繪製中心顏色,可開啟這段

                myArr.Stroke = new SolidColorBrush(System.Windows.Media.Color.FromRgb(data.state.colorR, data.state.colorG, data.state.colorB));
                //myArr.Width = Math.Abs(data.controlBtn4.X - data.controlBtn1.X);
                //myArr.Height = Math.Abs(data.controlBtn4.Y - data.controlBtn1.Y);
                PointCollection Points = new PointCollection();

                Points.Add(data.controlBtn1);
                Points.Add(point3);
                Points.Add(point1);
                Points.Add(data.controlBtn4);
                Points.Add(point2);
                Points.Add(point3);


                myArr.Points = new PointCollection(Points);
                //  myArr.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
                myArr.HorizontalAlignment  = System.Windows.HorizontalAlignment.Left;
                myArr.VerticalAlignment    = VerticalAlignment.Center;
                myArr.StrokeThickness      = shapeLib.Data.strokeT;
                myArr.MouseLeftButtonDown += data.myLine_MouseLeftButtonDown;
                myArr.MouseEnter          += data.myLine_MouseEnter;
                myArr.MouseLeave          += data.myLine_MouseLeave;
                //   myLine.MouseEnter += data.myLine_MouseEnter;
                //   myLine.MouseLeave += data.myLine_MouseLeave;
                shapeLib.Data.mygrid.Children.Add(myArr);
                gv.baseShape.Add(myArr);
                // currPath.setDrawShape( myArr);
            }
            else
            {
                Polyline        myArr  = (Polyline)gv.baseShape[0];// =(Line) currPath.getDrawShape();
                PointCollection Points = new PointCollection();
                double          num1   = Math.Atan2((data.controlBtn4.X - data.controlBtn1.X), (data.controlBtn4.Y - data.controlBtn1.Y));
                double          num2   = 0.5;
                double          num3   = 6.0;
                Point           point1 = new Point();
                Point           point2 = new Point();
                Point           point3 = new Point();
                point1.X = data.controlBtn4.X - ((num3 * Math.Sin(num1 - num2)));
                point1.Y = data.controlBtn4.Y - ((num3 * Math.Cos(num1 - num2)));
                point2.X = data.controlBtn4.X - ((num3 * Math.Sin(num1 + num2)));
                point2.Y = data.controlBtn4.Y - ((num3 * Math.Cos(num1 + num2)));
                point3.X = point1.X - (point1.X - point2.X) / 2;
                point3.Y = point1.Y - (point1.Y - point2.Y) / 2;

                Points.Add(data.controlBtn1);
                Points.Add(point3);
                Points.Add(point1);
                Points.Add(data.controlBtn4);
                Points.Add(point2);
                Points.Add(point3);
                myArr.Points = new PointCollection(Points);
                // myLine.Margin = new Thickness(data.controlBtn1.X, data.controlBtn1.Y, 0, 0);
            }
        }