ArcEngine选中面要素样式修改

时间:2023-03-09 02:59:27
ArcEngine选中面要素样式修改
            //只用前五行,可以直接将选中的面要素的颜色全部修改成红色,也就是填充颜色
IRgbColor pRgbColor= new RgbColor();;
pRgbColor.Red = ;
pRgbColor.Green = ;
pRgbColor.Blue = ;
IFeatureSelection pFtSelection = pFeatureLayer as IFeatureSelection;
//符号边线颜色 ,下边这五行设定选中面的边线,但是需要配合后边的代码执行
IRgbColor pLineColor = new RgbColor();
pLineColor.Red = ;
ILineSymbol ilSymbl = new SimpleLineSymbolClass();
ilSymbl.Color = pLineColor;
ilSymbl.Width = ; //定义选中要素的符号为红色,这部分的作用并没有搞清楚,随后可能还需要研究
ISimpleFillSymbol ipSimpleFillSymbol = new SimpleFillSymbol();
ipSimpleFillSymbol.Outline = ilSymbl;
RgbColor pFillColor = new RgbColor();
pFillColor.Green = ;
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的开发真是难入门,所以这里赶紧记下来,当然这里的代码是通过网上搜索的代码又修改的,记录下,自己可以用,别人也可以用