Beispiel #1
0
        /// <summary>
        /// 显示绘图窗口
        /// </summary>
        /// <param name="gList">图元列表</param>
        public void ShowMap(List <GElement> gList)
        {
            frmMap frmObj = new frmMap();

            frmObj.gList = gList;
            frmObj.ShowDialog();
        }
        private void pictureBox3_Click(object sender, EventArgs e)
        {
            frmMap frmMap = new frmMap();

            frmMap.Show();
            this.Hide();
        }
        private void btnOpenProject_Click(object sender, EventArgs e)
        {
            try
            {
                int x = int.Parse(this.dtgvListProject.CurrentRow.Cells[0].Value.ToString());
                OpenPro = x;
                this.Close();

                var pro = ProjectController.getProject(OpenPro);
                frmOutliner.note = pro.Note;


                frmMap fMap = new frmMap();
                fMap.Show();
                List <Shape> openShape = new List <Shape>();

                openShape = ShapeController.getListShape(OpenPro);
                foreach (var s in openShape)
                {
                    if (s.NameShape == "Root")
                    {
                        MessageBox.Show("Project " + OpenPro);
                        frmMap.root = new Root(s.ID, "Root", new Point(Convert.ToInt32(s.LocationX), Convert.ToInt32(s.LocationY)), Convert.ToInt32(s.Witdh), Convert.ToInt32(s.Height));
                        frmMap.root.Draw(fMap.g2, fMap.myPen);

                        Infor infor = TextController.getInfor(s.ID);
                        if (infor != null)
                        {
                            RichTextBox rt = new RichTextBox();
                            rt.Visible  = true;
                            rt.Location = new Point(Convert.ToInt32(infor.LocationX), Convert.ToInt32(infor.LocationY));
                            rt.Size     = new Size(Convert.ToInt32(infor.Witdh), Convert.ToInt32(infor.Height));
                            rt.Text     = infor.Description;
                            rt.Tag      = infor.ID;
                            fMap.ptbDraw.Controls.Add(rt);
                            fMap.lstRt.Add(rt);
                        }
                    }
                    else if (s.NameShape == "Rectangle")
                    {
                        //MessageBox.Show("Rec");
                        Rec rec = new Rec(s.ID, "Rectangle", new Point(Convert.ToInt32(s.LocationX), Convert.ToInt32(s.LocationY)), Convert.ToInt32(s.Witdh), Convert.ToInt32(s.Height));
                        frmMap.root.lstObj.Add(rec);

                        Infor infor = TextController.getInfor(s.ID);
                        if (infor != null)
                        {
                            RichTextBox rt = new RichTextBox();
                            rt.Visible  = true;
                            rt.Location = new Point(Convert.ToInt32(infor.LocationX), Convert.ToInt32(infor.LocationY));
                            rt.Size     = new Size(Convert.ToInt32(infor.Witdh), Convert.ToInt32(infor.Height));
                            rt.Text     = infor.Description;
                            rt.Tag      = infor.ID;
                            fMap.ptbDraw.Controls.Add(rt);
                            fMap.lstRt.Add(rt);
                        }
                    }
                    else if (s.NameShape == "Circle")
                    {
                        //MessageBox.Show("Cir");
                        Circle cir = new Circle(s.ID, "Circle", new Point(Convert.ToInt32(s.LocationX), Convert.ToInt32(s.LocationY)), Convert.ToInt32(s.Witdh), Convert.ToInt32(s.Height));
                        frmMap.root.lstObj.Add(cir);

                        Infor infor = TextController.getInfor(s.ID);
                        if (infor != null)
                        {
                            RichTextBox rt = new RichTextBox();
                            rt.Visible  = true;
                            rt.Location = new Point(Convert.ToInt32(infor.LocationX), Convert.ToInt32(infor.LocationY));
                            rt.Size     = new Size(Convert.ToInt32(infor.Witdh), Convert.ToInt32(infor.Height));
                            rt.Text     = infor.Description;
                            rt.Tag      = infor.ID;
                            fMap.ptbDraw.Controls.Add(rt);
                            fMap.lstRt.Add(rt);
                        }
                    }
                    else if (s.NameShape == "Curve")
                    {
                        //MessageBox.Show("Cur");
                        Curve cur = new Curve(s.ID, "Curve", new Point(Convert.ToInt32(s.LocationX), Convert.ToInt32(s.LocationY)), new Point(Convert.ToInt32(s.LocationX2), Convert.ToInt32(s.LocationY2)), Convert.ToInt32(s.Witdh), Convert.ToInt32(s.Height));
                        frmMap.root.lstObj.Add(cur);
                    }
                }
                fMap.DrawObj(frmMap.root);
            } catch { }
        }