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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值