全国高分辨率土地利用数据服务 土地利用数据服务 土地覆盖数据服务 坡度数据服务 土壤侵蚀数据服务 全国各省市DEM数据服务 耕地资源空间分布数据服务 草地资源空间分布数据服务 林地资源空间分布数据服务 水域资源空间分布数据服务 建设用地空间分布数据服务 地形、地貌、土壤数据服务 分坡度耕地数据服务 全国大宗农作物种植范围空间分布数据服务
多种卫星遥感数据反演植被覆盖度数据服务 地表反照率数据服务 比辐射率数据服务 地表温度数据服务 地表蒸腾与蒸散数据服务 归一化植被指数数据服务 叶面积指数数据服务 净初级生产力数据服务 净生态系统生产力数据服务 生态系统总初级生产力数据服务 生态系统类型分布数据服务 土壤类型质地养分数据服务 生态系统空间分布数据服务 增强型植被指数数据服务
多年平均气温空间分布数据服务 多年平均降水量空间分布数据服务 湿润指数数据服务 大于0℃积温空间分布数据服务 光合有效辐射分量数据服务 显热/潜热信息数据服务 波文比信息数据服务 地表净辐射通量数据服务 光合有效辐射数据服务 温度带分区数据服务 山区小气候因子精细数据服务
全国夜间灯光指数数据服务 全国GDP公里格网数据服务 全国建筑物总面积公里格网数据服务 全国人口密度数据服务 全国县级医院分布数据服务 人口调查空间分布数据服务 收入统计空间分布数据服务 矿山面积统计及分布数据服务 载畜量及空间分布数据服务 农作物种植面积统计数据服务 农田分类面积统计数据服务 农作物长势遥感监测数据服务 医疗资源统计数据服务 教育资源统计数据服务 行政辖区信息数据服务
Landsat 8 高分二号 高分一号 SPOT-6卫星影像 法国Pleiades高分卫星 资源三号卫星 风云3号 中巴资源卫星 NOAA/AVHRR MODIS Landsat TM 环境小卫星 Landsat MSS 天绘一号卫星影像
编写一个colorramp下拉框,无非就做两件事,首先将colorramp绘制成一个bitmap图片,其次就是将该图片绘制到combobox的item上。
那么现看看后面一个问题怎么绘制到combobox上:vb.net代码实例
首先在form上加载一个imagelist,将要绘制的图片存放到里面(将以自己截个colorramp的图片),再加载combobox,将其Drawmode设置为owenrdrawfixed,然后在其DrawItem事件中编写
Private Sub ComboBox1_DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles ComboBox1.DrawItem
Dim iRectangle As System.Drawing.Rectangle
If e.Index = -1 Or sender Is Nothing Then
Exit Sub
Else
'绘制背景
e.DrawBackground()
'绘制焦点框
e.DrawFocusRectangle()
'绘制图例
iRectangle = New System.Drawing.Rectangle(e.Bounds.Left + 1, e.Bounds.Top + 1, 117, 14)
e.Graphics.DrawImage(Me.ImageList1.Images(e.Index), iRectangle)
End If
End Sub
复制代码
上面一段代码就可以将imagelist中相应序号的图片绘制到相应序号的item上了,视觉部分完毕,很easy吧?
有了上面的过程我们就应该思考怎么样得到指定colorramp的图像,如果能得到colorramp的图像,只要替换imagelist中的图片就可以实现我们的目的。
注意:下面的代码首先新建一个ESRI.ArcGIS.Display.IGradientFillSymbol和一个ColorRamp
Private Sub DrawColorRamp()
'新建 m_FillSymbol和m_ColorRamp
m_FillSymbol.ColorRamp = m_ColorRamp
Me.PictureBox1.Image = SymbolToBitmap(m_FillSymbol, 0, Me.PictureBox1.Width, Me.PictureBox1.Height)
End Sub
复制代码
Friend Function SymbolToBitmap(ByVal iSymbol As ESRI.ArcGIS.Display.ISymbol, ByVal iStyle As Integer, ByVal iWidth As Integer, ByVal iHeight As Integer) As System.Drawing.Bitmap
Dim iHDC As New IntPtr
Dim iBitmap As System.Drawing.Bitmap
Dim iGraphics As System.Drawing.Graphics
Dim itagRECT As ESRI.ArcGIS.Display.tagRECT
Dim iEnvelope As ESRI.ArcGIS.Geometry.IEnvelope
Dim iDisplayTransformation As ESRI.ArcGIS.Display.IDisplayTransformation
Dim iPoint As ESRI.ArcGIS.Geometry.IPoint
Dim iPolyline As ESRI.ArcGIS.Geometry.IGeometryCollection
Dim iPolygon As ESRI.ArcGIS.Geometry.IGeometryCollection
Dim iRing As ESRI.ArcGIS.Geometry.IRing
Dim iSegmentCollection As ESRI.ArcGIS.Geometry.ISegmentCollection
Dim iGeometry As ESRI.ArcGIS.Geometry.IGeometry
iBitmap = New System.Drawing.Bitmap(iWidth, iHeight)
iGraphics = System.Drawing.Graphics.FromImage(iBitmap)
iEnvelope = New ESRI.ArcGIS.Geometry.Envelope
iEnvelope.PutCoords(0, 0, iWidth, iHeight)
With itagRECT
.left = 0
.right = iWidth
.top = 0
.bottom = iHeight
End With
iDisplayTransformation = New ESRI.ArcGIS.Display.DisplayTransformation
With iDisplayTransformation
.VisibleBounds = iEnvelope
.Bounds = iEnvelope
.DeviceFrame = itagRECT
.Resolution = iGraphics.DpiX
End With
iHDC = iGraphics.GetHdc.ToInt32
'获取Geometry
If TypeOf (iSymbol) Is ESRI.ArcGIS.Display.IMarkerSymbol Then
Select Case iStyle
Case 0
iPoint = New ESRI.ArcGIS.Geometry.Point
iPoint.PutCoords(iWidth / 2, iHeight / 2)
iGeometry = iPoint
End Select
ElseIf TypeOf (iSymbol) Is ESRI.ArcGIS.Display.ILineSymbol Then
iSegmentCollection = New ESRI.ArcGIS.Geometry.Path
iPolyline = New ESRI.ArcGIS.Geometry.Polyline
Select Case iStyle
Case 0
iSegmentCollection.AddSegment(CreateLine(0, iHeight / 2, iWidth, iHeight / 2))
iPolyline.AddGeometry(iSegmentCollection)
iGeometry = iPolyline
Case 1
iSegmentCollection.AddSegment(CreateLine(0, iHeight / 4, iWidth / 4, 3 * iHeight / 4))
iSegmentCollection.AddSegment(CreateLine(iWidth / 4, 3 * iHeight / 4, 3 * iWidth / 4, iHeight / 4))
iSegmentCollection.AddSegment(CreateLine(3 * iWidth / 4, iHeight / 4, iWidth, 3 * iHeight / 4))
iPolyline.AddGeometry(iSegmentCollection)
iGeometry = iPolyline
End Select
ElseIf TypeOf (iSymbol) Is ESRI.ArcGIS.Display.IFillSymbol Then
iSegmentCollection = New ESRI.ArcGIS.Geometry.Ring
iPolygon = New ESRI.ArcGIS.Geometry.Polygon
Select Case iStyle
Case 0
iSegmentCollection.AddSegment(CreateLine(5, iHeight - 5, iWidth - 6, iHeight - 5))
iSegmentCollection.AddSegment(CreateLine(iWidth - 6, iHeight - 5, iWidth - 6, 6))
iSegmentCollection.AddSegment(CreateLine(iWidth - 6, 6, 5, 6))
iRing = iSegmentCollection
iRing.Close()
iPolygon.AddGeometry(iSegmentCollection)
iGeometry = iPolygon
End Select
ElseIf TypeOf (iSymbol) Is ESRI.ArcGIS.Display.ISimpleTextSymbol Then
Select Case iStyle
Case 0
iPoint = New ESRI.ArcGIS.Geometry.Point
iPoint.PutCoords(iWidth / 2, iHeight / 2)
iGeometry = iPoint
End Select
End If
'绘制图形
iSymbol.SetupDC(iHDC, iDisplayTransformation)
iSymbol.Draw(iGeometry)
iSymbol.ResetDC()
iGraphics.ReleaseHdc(iHDC)
iGraphics.Dispose()
SymbolToBitmap = iBitmap
End Function
复制代码
过程基本就完成了,应该说没什么难度