예제 #1
0
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            //打开样式画面
            LayerStyleForm form = new LayerStyleForm();

            //查询街道原有样式
            string sql = SqlHelper.GetSql("SelectLayerType");
            List <SqlParameter> param = new List <SqlParameter>();

            param.Add(new SqlParameter("no", "4"));
            DataTable table = SqlHelper.Select(sql, param);

            //将原有样式显示在调整样式画面中
            form.FillBrush         = new SolidBrush(Color.FromArgb((int)table.Rows[0]["Fill"]));
            form.LinePen           = new Pen(Color.FromArgb((int)table.Rows[0]["Line"]), (int)table.Rows[0]["LineWidth"]);
            form.LinePen.DashStyle = (DashStyle)((int)table.Rows[0]["Line"]);
            form.OutLinePen        = new Pen(Color.FromArgb((int)table.Rows[0]["Outline"]), (int)table.Rows[0]["OutlineWidth"]);
            form.EnableOutline     = table.Rows[0]["EnableOutline"].ToString() == "1" ? true : false;
            int hatchbrush = -1;

            if (!int.TryParse(table.Rows[0]["hatchbrush"].ToString(), out hatchbrush))
            {
                hatchbrush = -1;
            }
            form.HatchStyle = hatchbrush;
            form.TextFont   = (Font)Common.DeserializeObject((byte[])table.Rows[0]["TextFont"]);
            form.TextColor  = Color.FromArgb((int)table.Rows[0]["TextColor"]);
            if (form.ShowDialog() == DialogResult.OK)
            {
                setLayerType("4", form);
            }
        }
예제 #2
0
 public void set(string txt)
 {
     try
     {
         List <SqlParameter> param = new List <SqlParameter>();
         string tableName          = "t_" + _Map.MapId + "_" + _Map.Layers["土地宗地图层"].ID;
         string sql = "select t1.ObjectData from t_object t1 left join " + tableName + " t2 on t1.ObjectId = t2.ObjectId and t1.LayerId = t2.LayerId and t1.MapId = t2.MapId where t2.flag =@flag";
         //param.Add(new SqlParameter("table1", tableName));
         param.Add(new SqlParameter("flag", txt));
         DataTable      table = SqlHelper.Select(sql, param);
         LayerStyleForm form  = new LayerStyleForm();
         if (form.ShowDialog() == DialogResult.OK)
         {
             foreach (DataRow row in table.Rows)
             {
                 byte[]   data = (byte[])row["ObjectData"];
                 Geometry geom = (Geometry)Common.DeserializeObject(data);
                 geom.Fill          = form.FillBrush.Color.ToArgb();
                 geom.Outline       = form.OutLinePen.Color.ToArgb();
                 geom.OutlineWidth  = (int)form.OutLinePen.Width;
                 geom.TextColor     = form.TextColor;
                 geom.TextFont      = form.TextFont;
                 geom.EnableOutline = form.EnableOutline;
                 geom.HatchStyle    = form.HatchStyle;
                 geom.Line          = form.LinePen.Color.ToArgb();
                 geom.DashStyle     = (int)form.LinePen.DashStyle;
                 geom.StyleType     = 1;
                 geom.Penstyle      = form.Penstyle;
                 MapDBClass.UpdateObject(_Map.MapId, geom);
             }
         }
     }
     catch (Exception ex) {
         MessageBox.Show(ex.ToString());
     }
 }