Exemplo n.º 1
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());
     }
 }