|
阅读:1325回复:4
请问用AO如何改变一个实体的颜色属性?
<P>请问:用AO如何改变一个实体的颜色属性?望给出思路或者代码,谢谢各位!在线等待!</P><img src="images/post/smile/dvbbs/em12.gif" />
|
|
|
1楼#
发布于:2005-03-23 14:11
<P>给你两个函数,直接调用SetLayerRendererWithRGB函数,就可以了</P><P>'‖=================================================
'‖功能:设置图层颜色 '‖参数:图层 RGB颜色数值 '‖输出: '‖=================================================</P><P>Public Sub SetLayerRendererWithRGB(ByVal pFeatureLayer As IFeatureLayer, rValue As Integer, gValue As Integer, bValue As Integer) Dim pGeoFeatureLayer As esriCarto.IGeoFeatureLayer Set pGeoFeatureLayer = pFeatureLayer Dim pSym As ISimpleRenderer Set pSym = New SimpleRenderer Set pSym.Symbol = MakeSymbol(pFeatureLayer.FeatureClass.ShapeType, rValue, gValue, bValue, 255) Set pGeoFeatureLayer.Renderer = pSym End Sub</P><P> '‖================================================= '‖功能:设置符号 '‖参数:图层类型 RGB颜色数值 透明度 大小(这里直接定了3,可根据需要修改) '‖输出: '‖=================================================</P><P>Public Function MakeSymbol(iGeometryType As Integer, rValue As Integer, gValue As Integer, bValue As Integer, iTransparency As Integer, Optional Size As Integer = 3) As ISymbol Dim pSimplefillsymbol As esriDisplay.ISimpleFillSymbol Dim pSimpleLineSymbol As esriDisplay.ISimpleLineSymbol Dim pMarkerSymbol As esriDisplay.ISimpleMarkerSymbol Dim pColor As esriDisplay.IRgbColor Set pColor = New esriDisplay.rgbcolor pColor.RGB = RGB(rValue, gValue, bValue) pColor.Transparency = iTransparency Select Case iGeometryType Case esriGeometryPolygon, esriGeometryEnvelope Set pSimplefillsymbol = New esriDisplay.SimpleFillSymbol pSimplefillsymbol.Style = esriSFSSolid pSimplefillsymbol.Color = pColor pSimplefillsymbol.Outline.Width = 0 Set MakeSymbol = pSimplefillsymbol Case esriGeometryPolyline, esriGeometryLine Set pSimpleLineSymbol = New esriDisplay.SimpleLineSymbol pSimpleLineSymbol.Color = pColor pSimpleLineSymbol.Style = esriSLSSolid pSimpleLineSymbol.Width = Size Set MakeSymbol = pSimpleLineSymbol Case esriGeometryPoint Set pMarkerSymbol = New esriDisplay.SimpleMarkerSymbol pMarkerSymbol.Color = pColor pMarkerSymbol.Style = esriSMSCircle pMarkerSymbol.Size = Size Set MakeSymbol = pMarkerSymbol Case esriGeometryMultipoint Set pMarkerSymbol = New esriDisplay.SimpleMarkerSymbol pMarkerSymbol.Color = pColor pMarkerSymbol.Style = esriSMSCircle pMarkerSymbol.Size = Size Set MakeSymbol = pMarkerSymbol End Select End Function </P> |
|
|
|
2楼#
发布于:2005-03-23 14:24
RE:
<P><img src="images/post/smile/dvbbs/em12.gif" />!</P> <P>但是,如果我想对该层中的每一个具体Feature,根据它们的相应属性设置它们的颜色值呢?具体该如何做呀!</P><img src="images/post/smile/dvbbs/em02.gif" /> |
|
|
3楼#
发布于:2005-03-23 15:17
先查询出来,然后再改变他的样式
|
|
|
|
4楼#
发布于:2005-05-05 20:55
<img src="images/post/smile/dvbbs/em01.gif" /><img src="images/post/smile/dvbbs/em02.gif" /><img src="images/post/smile/dvbbs/em05.gif" /><img src="images/post/smile/dvbbs/em04.gif" />
|
|