예제 #1
0
        private void GetObjectInformation()
        {
            DataTable table = MapDBClass.GetObjectById(MapId, LayerId, ObjectId);

            if (table != null && table.Rows.Count > 0)
            {
                byte[]   data     = (byte[])table.Rows[0]["ObjectData"];
                Geometry geometry = (Geometry)Common.DeserializeObject(data);
                Caption = ObjectName;// geometry.Text;
                if (Caption == null)
                {
                    Caption = "";
                }
                Message = geometry.Message;
                if (Message == null)
                {
                    Message = "";
                }
                tabControl1.TabPages.Clear();
                List <Image> images = MapDBClass.GetPicures(MapId, LayerId, ObjectId);
                _Images = images;
                for (int i = 0; i < images.Count; i++)
                {
                    int index = i + 1;
                    tabControl1.TabPages.Add(index.ToString(), index.ToString());
                    PictureBox pic = new PictureBox();
                    pic.Image    = images[i];
                    pic.SizeMode = PictureBoxSizeMode.Zoom;
                    pic.Click   += new EventHandler(pic_Click);
                    pic.Cursor   = Cursors.Hand;
                    tabControl1.TabPages[i].Controls.Add(pic);
                    pic.Dock = DockStyle.Fill;
                }
                if (images == null || images.Count <= 0)
                {
                    tabControl1.Visible = false;
                }
                else
                {
                    tabControl1.Visible = true;
                    //tabControl1.Location = new System.Drawing.Point(10, this.Height-100);
                }
            }
            try
            {
                List <SqlParameter> param = new List <SqlParameter>();
                param.Add(new SqlParameter("MapId", MapId));
                param.Add(new SqlParameter("LayerId", LayerId));
                param.Add(new SqlParameter("ObjectId", ObjectId));
                table = SqlHelper.Select(SqlHelper.GetSql("SelectProjectByObject"), param);
                btnProjectArea.Visible      = table != null && table.Rows.Count > 0;
                btnProjectAreaPrice.Visible = btnProjectArea.Visible;
            }
            catch (Exception ex)
            {
                Common.ShowError(ex);
            }
        }