dongshan
路人甲
路人甲
  • 注册日期2005-06-25
  • 发帖数26
  • QQ155351222
  • 铜币257枚
  • 威望0点
  • 贡献值0点
  • 银元0个
阅读:2550回复:6

[求助]请问谁有利用VB在Mapcontrol控件上画图的程序?

楼主#
更多 发布于:2006-04-13 10:33
<P>请问谁有利用VB在Mapcontrol控件上画图的程序,说个能下载的网址也行,也可以发到我的E-mail.</P>
<P>我的E-mail: <a href="mailtluodongshan_whu@163.com" target="_blank" >luodongshan_whu@163.com</A></P>
<P>谢谢各位!</P>
喜欢0 评分0
tiu
tiu
路人甲
路人甲
  • 注册日期2004-05-16
  • 发帖数17
  • QQ
  • 铜币173枚
  • 威望0点
  • 贡献值0点
  • 银元0个
1楼#
发布于:2006-04-13 11:48
<P>sample里面有的</P>
举报 回复(0) 喜欢(0)     评分
dongshan
路人甲
路人甲
  • 注册日期2005-06-25
  • 发帖数26
  • QQ155351222
  • 铜币257枚
  • 威望0点
  • 贡献值0点
  • 银元0个
2楼#
发布于:2006-04-13 13:47
好像没有画椭圆或圆的。
举报 回复(0) 喜欢(0)     评分
lizehua1394
路人甲
路人甲
  • 注册日期2006-02-21
  • 发帖数76
  • QQ
  • 铜币19枚
  • 威望0点
  • 贡献值0点
  • 银元0个
3楼#
发布于:2006-05-17 22:24
说废话  高手都这么说来着  傻瓜都知道
举报 回复(0) 喜欢(0)     评分
xikelife
路人甲
路人甲
  • 注册日期2006-04-05
  • 发帖数50
  • QQ
  • 铜币246枚
  • 威望0点
  • 贡献值0点
  • 银元0个
4楼#
发布于:2006-06-22 12:03
<P>晕 楼猪的个性签名里面怎么会显示我的信息呢???</P>
我想起昨天风吹动的夜晚 坐在我身边我所有的朋友 岁月让我们已变得沉默 没有人再会谈论明天
举报 回复(0) 喜欢(0)     评分
gis
gis
管理员
管理员
  • 注册日期2003-07-16
  • 发帖数15947
  • QQ554730525
  • 铜币25339枚
  • 威望15364点
  • 贡献值0点
  • 银元0个
  • GIS帝国居民
  • 帝国沙发管家
  • GIS帝国明星
  • GIS帝国铁杆
5楼#
发布于:2006-06-24 10:53
<P>自己动手吧,然后问点具体的问题,大家没做这个方面的,不可能帮你一个一个全打出来给你吧?下面的例子是根据一个多边形绘制一个圆,可以参考</P><PRE>Sub DrawCircleFromSelectedPolygon()
  'Get the first selected feature
  Dim pMxDoc As IMxDocument
  Set pMxDoc = ThisDocument
  Dim pEnumFeature As IEnumFeature
  Set pEnumFeature = pMxDoc.FocusMap.FeatureSelection
  pEnumFeature.Reset
  Dim pFeature As IFeature
  Set pFeature = pEnumFeature.Next
  If pFeature Is Nothing Then
  MsgBox "Select a feature"
  Exit Sub
  End If
  
  Dim pGeom As IGeometry
  Set pGeom = pFeature.ShapeCopy
  'Get the shape's centroid
  Dim pCenter As IPoint
  Dim pArea As IArea, pCurve As ICurve, pPt As IPoint, pPtCol As IPointCollection
  Dim pCopier As IClone, pEnv As IEnvelope
  Dim i As Long
  If TypeOf pGeom Is IArea Then
    Set pArea = pGeom
    Set pCenter = pArea.Centroid
  ElseIf TypeOf pGeom Is ICurve Then
    'use midpoint
    Set pCurve = pGeom
    Set pCenter = New esriCore.Point
    pCurve.QueryPoint esriNoExtension, 0.5, True, pCenter
    'alternatively, take a weighted average of segment centroids to find a "centroid"
    'instead of midpoint, or use envelope center
  ElseIf TypeOf pGeom Is IMultipoint Then
    'use average of points
    Set pPtCol = pGeom
    Set pCenter = New esriCore.Point
    Set pCenter.SpatialReference = pGeom.SpatialReference
    pCenter.PutCoords 0, 0
    For i = pPtCol.PointCount - 1 To 0 Step -1
      Set pPt = pPtCol.Point(i)
      pCenter.X = pCenter.X + pPt.X
      pCenter.Y = pCenter.Y + pPt.Y
    Next i
    
    pCenter.X = pCenter.X / pPtCol.PointCount
    pCenter.Y = pCenter.Y / pPtCol.PointCount
  ElseIf TypeOf pGeom Is IPoint Then
    'use the point itself
    Set pCopier = pGeom
    Set pCenter = pCopier.Clone
  Else
    MsgBox "unexpected type; geometry type is " ; pGeom.GeometryType ; "; using center of envelope"
    Set pEnv = pGeom.Envelope
    Set pCenter = New esriCore.Point
    Set pCenter.SpatialReference = pGeom.SpatialReference
    pCenter.PutCoords 0.5 * (pEnv.XMax + pEnv.XMin), 0.5 * (pEnv.YMax + pEnv.YMin)
  End If
  
  'Add the circle segment to a polygon geometry
  Dim pSegmentCollection As ISegmentCollection
  Set pSegmentCollection = New Polygon
  Dim pPolygon As IPolygon
  Set pPolygon = pSegmentCollection
  pSegmentCollection.SetCircle pCenter, InputBox("radius:")
'  pPolygon.Close
  
  'Create a graphic element from the circle
  Dim pGraphCont As IGraphicsContainer
  Set pGraphCont = pMxDoc.ActiveView
  Dim pElement As IElement
  Set pElement = New PolygonElement
  pElement.Geometry = pSegmentCollection
  Dim pFillElement As IFillShapeElement
  Set pFillElement = pElement
  'I'm assuming here that the symbol and color are both returned as references. If not, you
  'may have to get a property, modify it, and set it back to have your changes take effect.
  pFillElement.Symbol.Color.NullColor = True
  pGraphCont.AddElement pElement, 0
  
  'refresh
  pMxDoc.ActiveView.PartialRefresh esriViewGraphics, Nothing, pPolygon.Envelope
End Sub
</PRE>
举报 回复(0) 喜欢(0)     评分
ienown
路人甲
路人甲
  • 注册日期2006-11-14
  • 发帖数23
  • QQ6805791
  • 铜币149枚
  • 威望0点
  • 贡献值0点
  • 银元0个
6楼#
发布于:2008-03-11 10:12
学习中..............
举报 回复(0) 喜欢(0)     评分
游客

返回顶部