dfsh1983
路人甲
路人甲
  • 注册日期2005-08-03
  • 发帖数23
  • QQ
  • 铜币195枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:1727回复:4

VB+AE 颜色图的请教?

楼主#
更多 发布于:2005-10-16 14:26
      我想使得一个图层中的每个polygon的颜色都不同,说的通俗点就是让图层的颜色变成彩色.再次请教有代码没?
喜欢0 评分0
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2005-10-16 20:47
<P>帮顶先</P>
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
NONE
路人甲
路人甲
  • 注册日期2003-07-26
  • 发帖数159
  • QQ
  • 铜币616枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2005-10-16 23:46
<P>专题图</P>
<P><a href="http://www.gisempire.com/bbs/dispbbs.asp?boardID=62;ID=29338;page=1" target="_blank" >http://www.gisempire.com/bbs/dispbbs.asp?boardID=62;ID=29338;page=1</A></P>
举报 回复(0) 喜欢(0)     评分
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2005-10-17 12:40
<P>为什么我的总在fieldNumber = pTable.FindField(strNameField)这句报错? </P>
<P> Dim pUniqueValueRenderer As IUniqueValueRenderer<br>  Dim pSym As IFillSymbol<br>  Dim pColor As IColor<br>  Dim pNextUniqueColor As IColor<br>  Dim pEnumRamp As IEnumColors<br>  Dim pTable As ITable<br>  Dim fieldNumber As Long<br>  Dim pNextRow As IRow<br>  Dim pNextRowBuffer As IRowBuffer<br>  Dim pCursor As ICursor<br>  Dim pQueryFilter As IQueryFilter<br>  Dim codeValue As Variant</P>
<P>    '<br>  Set pUniqueValueRenderer = New UniqueValueRenderer<br>  <br>  ' QI the table from the geoFeatureLayer and get the field number of<br>  '<br>  Set pTable = m_pGeoFeatureLayer<br>  fieldNumber = pTable.FindField(strNameField)<br>  If fieldNumber = -1 Then<br>    MsgBox "Can't find field called " ; strNameField<br>    Exit Sub<br>  End If<br>  <br>  ' Specify the fied to renderer unique values with<br>  '<br>  pUniqueValueRenderer.FieldCount = 1<br>  pUniqueValueRenderer.Field(0) = strNameField<br>  <br>  ' Set up the Color ramp, this came from looking at ArcMaps Color Ramp<br>  ' properties for Pastels.<br>  '<br>  Dim pColorRamp As IRandomColorRamp<br>  <br>  Set pColorRamp = New RandomColorRamp<br>  pColorRamp.StartHue = 0<br>  pColorRamp.MinValue = 99<br>  pColorRamp.MinSaturation = 15<br>  pColorRamp.EndHue = 360<br>  pColorRamp.MaxValue = 100<br>  pColorRamp.MaxSaturation = 30<br>  pColorRamp.Size = 100<br>  pColorRamp.CreateRamp True<br>  Set pEnumRamp = pColorRamp.Colors<br>  Set pNextUniqueColor = Nothing<br>   <br>  ' Get a enumerator on the first row of the Layer<br>  '<br>  Set pQueryFilter = New QueryFilter<br>  pQueryFilter.AddField strNameField<br>  Set pCursor = pTable.Search(pQueryFilter, True)<br>  Set pNextRow = pCursor.NextRow<br><br>  <br>  ' Iterate through each row, adding values and a color to the unique value renderer<br>  ' Note we don't bother filtering out duplicates,<br>  ' if we add in a second value that is already there<br>  ' the symbol changes but the value remains<br>  '<br>  Do While Not pNextRow Is Nothing</P>
<P>    ' QI the row buffer from the row and get the value<br>    '<br>    Set pNextRowBuffer = pNextRow<br>    codeValue = pNextRowBuffer.Value(fieldNumber)</P>
<P>    ' Get a Color object from the color ramp and advance the enumerator<br>    ' if we've run out then reset and start again<br>    '<br>    Set pNextUniqueColor = pEnumRamp.Next<br>    If pNextUniqueColor Is Nothing Then<br>      pEnumRamp.Reset<br>      Set pNextUniqueColor = pEnumRamp.Next<br>    End If</P>
<P>    ' Set the symbol to the Color and add it to render a given value<br>    '<br>    Set pSym = New SimpleFillSymbol<br>    pSym.Color = pNextUniqueColor<br>    pUniqueValueRenderer.AddValue codeValue, codeValue, pSym</P>
<P>    ' Advance the cursor to the next row, or end of the dataset<br>    '<br>    Set pNextRow = pCursor.NextRow</P>
<P>  Loop<br>  <br>  ' Now set the layers renderer to the unique value renderer<br>  '<br>  Set m_pGeoFeatureLayer.renderer = pUniqueValueRenderer<br>  <br>  Form1.MapControl1.Refresh esriViewGeography</P><br><br><br>

[此贴子已经被作者于2005-10-17 12:41:12编辑过]
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
木白林
路人甲
路人甲
  • 注册日期2004-03-19
  • 发帖数319
  • QQ
  • 铜币824枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2005-11-03 22:22
再顶一下
心情卡片 一起分享...
举报 回复(0) 喜欢(0)     评分
游客

返回顶部