Mapxtreme7.0 主题图透明色

   1:  #region 主题图
   2:   
   3:          private MapInfo.Mapping.Thematics.RangedTheme thm;
   4:   
   5:          private void SetMapGray(string name)
   6:          {
   7:              try
   8:              {
   9:                  ClearTheme();
  10:   
  11:                
  12:                  //全部设置为0
  13:                  MapInfo.Data.MIConnection mapconn = new MapInfo.Data.MIConnection();
  14:                  mapconn.Open();
  15:                  MapInfo.Data.MICommand command = mapconn.CreateCommand();
  16:                  command.CommandText = "update 上海乡镇街道new set num =0";
  17:                  command.ExecuteNonQuery();
  18:                  command.Dispose();
  19:                  mapconn.Close();
  20:   
  21:                  //选择的设置为1
  22:                  string mapsql = "update 上海乡镇街道new  set num = 1 where district like '%" + name + "%'";
  23:                  mapconn = new MapInfo.Data.MIConnection();
  24:                  mapconn.Open();
  25:                  command = mapconn.CreateCommand();
  26:                  command.CommandText = mapsql;
  27:                  command.ExecuteNonQuery();
  28:                  mapconn.Close();
  29:   
  30:   
  31:                  this.mapControl1.Map.DrawingAttributes.EnableTranslucency = true;
  32:                  this.mapControl1.Map.DrawingAttributes.SmoothingMode = SmoothingMode.AntiAlias;
  33:   
  34:   
  35:                  //通过专题图显示
  36:                  MapInfo.Mapping.FeatureLayer flyr = mapControl1.Map.Layers["上海乡镇街道new"] as MapInfo.Mapping.FeatureLayer;
  37:                  thm = new MapInfo.Mapping.Thematics.RangedTheme(flyr, "num", "num", 1, MapInfo.Mapping.Thematics.DistributionMethod.CustomRanges);
  38:   
  39:                  thm.Bins[0].Min = 0;
  40:                  thm.Bins[0].Max = 0;
  41:                  thm.RecomputeBins();
  42:   
  43:   
  44:                  int startAlpha = (int)(255 * 0.25);
  45:                  int endAlpha = (int)(255 * 0.75);
  46:   
  47:                  thm.Bins[0].Style.AreaStyle.Interior = new MapInfo.Styles.SimpleInterior((int)MapInfo.Styles.PatternStyle.Solid, System.Drawing.Color.FromArgb(endAlpha, System.Drawing.Color.LightGray));
  48:                  thm.SpreadBy = MapInfo.Mapping.Thematics.SpreadByPart.Color;
  49:                  thm.ApplyStylePart = MapInfo.Mapping.Thematics.StylePart.Color;
  50:                  thm.ColorSpreadBy = MapInfo.Mapping.Thematics.ColorSpreadMethod.Rgb;
  51:   
  52:   
  53:    
  54:   
  55:                  thm.RecomputeStyles();
  56:   
  57:                  flyr.Modifiers.Append(thm);
  58:   
  59:                  mapControl1.Refresh();
  60:              }
  61:              catch (Exception ex)
  62:              {
  63:                  PubFun.Log.WriteLog(ex.ToString());
  64:              }
  65:          }

转载于:https://www.cnblogs.com/googlegis/archive/2011/01/06/2978861.html

你可能感兴趣的:(Mapxtreme7.0 主题图透明色)