public void AddGObject(int x1, int y1, int x2, int y2, string ObjType)                   //增加元件
        {
            Graphics  g      = this.CreateGraphics();                                            //直接是在表單建立畫布
            Rectangle ObjRct = new Rectangle();                                                  //建立一個矩形變數
            Pen       p      = new Pen(Color.Blue);                                              //建立藍色畫筆
            Image     ObjImg;                                                                    //建立圖片元件
            string    ObjName = ObjType + "_" + GNetwork.LastIndexOfGObject(ObjType).ToString(); //建立預設元件名稱

            //
            if (ObjType == "Line")             //如果類型是線段
            {
                g.DrawLine(p, x1, y1, x2, y2); //把線段畫出來(藍色)
                int xm = (x1 + x2) / 2;
                int ym = (y1 + y2) / 2;
                AddText(xm, ym, ObjName, false);//新增文字
            }
            else
            {
                ObjImg        = FindGObjectTypeImage(ObjType); //載入對應圖片
                ObjRct.X      = x1;                            //設定矩形變數大小
                ObjRct.Y      = y1;                            //設定矩形變數大小
                ObjRct.Height = ObjImg.Height;                 //設定矩形變數大小
                ObjRct.Width  = ObjImg.Width;                  //設定矩形變數大小
                g.DrawImage(ObjImg, ObjRct);                   //匯出徒刑
                AddText(x1, y1, ObjName, true);                //新增文字
                x2 = x1 + ObjRct.Width;                        //按照圖片實際大小修正參數
                y2 = y1 + ObjRct.Height;                       //按照圖片實際大小修正參數
            }
            //
            GNetwork.AddGObject(ObjName, ObjType, x1, y1, x2, y2);//新增元件
        }
        public void AddGObject(int x1, int y1, int x2, int y2, string ObjType)
        {
            Graphics  g      = this.CreateGraphics();
            Rectangle ObjRct = new Rectangle();
            Pen       p      = new Pen(Color.Blue);
            Image     ObjImg;
            string    ObjName = ObjType + "_" + GNetwork.LastIndexOfGObject(ObjType).ToString();

            //
            if (ObjType == "Line")
            {
                g.DrawLine(p, x1, y1, x2, y2);
                int xm = (x1 + x2) / 2;
                int ym = (y1 + y2) / 2;
                AddText(xm, ym, ObjName, false);
            }
            else
            {
                ObjImg        = FindGObjectTypeImage(ObjType);
                ObjRct.X      = x1;
                ObjRct.Y      = y1;
                ObjRct.Height = ObjImg.Height;
                ObjRct.Width  = ObjImg.Width;
                g.DrawImage(ObjImg, ObjRct);
                AddText(x1, y1, ObjName, true);
                x2 = x1 + ObjRct.Width;
                y2 = y1 + ObjRct.Height;
            }
            //
            GNetwork.AddGObject(ObjName, ObjType, x1, y1, x2, y2);
        }