ArcEngine选中面要素样式修改

            //只用前五行,可以直接将选中的面要素的颜色全部修改成红色,也就是填充颜色
            IRgbColor pRgbColor= new RgbColor();;
            pRgbColor.Red = 255;
            pRgbColor.Green = 0;
            pRgbColor.Blue = 0;
            IFeatureSelection pFtSelection = pFeatureLayer as IFeatureSelection;
            //符号边线颜色 ,下边这五行设定选中面的边线,但是需要配合后边的代码执行
            IRgbColor pLineColor = new RgbColor();
            pLineColor.Red = 255;
            ILineSymbol ilSymbl = new SimpleLineSymbolClass();
            ilSymbl.Color = pLineColor;
            ilSymbl.Width = 3;

            //定义选中要素的符号为红色,这部分的作用并没有搞清楚,随后可能还需要研究 
            ISimpleFillSymbol ipSimpleFillSymbol = new SimpleFillSymbol();
            ipSimpleFillSymbol.Outline = ilSymbl;
            RgbColor pFillColor = new RgbColor();
            pFillColor.Green = 60;
            ipSimpleFillSymbol.Color = pFillColor;
            ipSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSNull;//设置成填充效果为空,也就是不填充,有很多填充效果,这是个枚举
            //ipSimpleFillSymbol.Style = esriSimpleFillStyle.esriSFSForwardDiagonal;

            //选取要素集 ,这里需要把pFeatureLayer 转换成IFeatureSelection 
            IFeatureSelection pFtSelection = pFeatureLayer as IFeatureSelection;
            pFtSelection.SetSelectionSymbol = true;
            pFtSelection.SelectionSymbol = (ISymbol)ipSimpleFillSymbol;        

arcengine的开发真是难入门,所以这里赶紧记下来,当然这里的代码是通过网上搜索的代码又修改的,记录下,自己可以用,别人也可以用

posted @ 2016-09-11 19:30  SOUTHER  阅读(2893)  评论(0编辑  收藏  举报