Supermap Objects API开发中禁用默认的选择集显示风格,启用自定义的显示风格的代码

        //#region 使用自定义风格设置选中状态
        Selection selection = new Selection();//从该记录集获取选择集
        selection.FromRecordset(recordsetTemp);
        selection.SetStyleOptions(StyleOptions.FillBackColor, true);
        selection.SetStyleOptions(StyleOptions.FillBackOpaque, true);
        selection.SetStyleOptions(StyleOptions.FillForeColor, true);
        selection.SetStyleOptions(StyleOptions.FillGradientAngle, true);
        selection.SetStyleOptions(StyleOptions.FillGradientMode, true);
        selection.SetStyleOptions(StyleOptions.FillGradientOffsetRatioX, true);
        selection.SetStyleOptions(StyleOptions.FillGradientOffsetRatioY, true);
        selection.SetStyleOptions(StyleOptions.FillOpaqueRate, true);
        selection.SetStyleOptions(StyleOptions.FillSymbolID, true);
        selection.SetStyleOptions(StyleOptions.LineColor, true);
        selection.SetStyleOptions(StyleOptions.LineSymbolID, true);
        selection.SetStyleOptions(StyleOptions.LineWidth, true);
        selection.SetStyleOptions(StyleOptions.MarkerAngle, true);
        selection.SetStyleOptions(StyleOptions.MarkerSize, true);
        selection.SetStyleOptions(StyleOptions.MarkerSymbolID, true);
        selection.IsDefaultStyleEnabled = false;//设置不使用默认选择风格
        GeoStyle geoStyle = selection.Style;//设置选择集的风格
        geoStyle.FillForeColor = Color.Blue;
        geoStyle.FillBackOpaque = false;
        geoStyle.FillBackColor = Color.Blue;
        geoStyle.FillSymbolID = 0;
        geoStyle.FillOpaqueRate = 0;
        geoStyle.LineColor = Color.Blue;
        geoStyle.LineWidth = 1.0;
        selection.Style = geoStyle;
        layer.Selection = selection;
        #endregion

 

posted @ 2020-09-09 19:23  rainbow70626  阅读(130)  评论(0编辑  收藏  举报