阅读:2822回复:6
[求助]请问谁有利用VB在Mapcontrol控件上画图的程序?
<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> |
|
1楼#
发布于:2008-03-11 10:12
学习中..............
|
|
2楼#
发布于: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> |
|
|
3楼#
发布于:2006-06-22 12:03
<P>晕 楼猪的个性签名里面怎么会显示我的信息呢???</P>
|
|
|
4楼#
发布于:2006-05-17 22:24
说废话 高手都这么说来着 傻瓜都知道
|
|
5楼#
发布于:2006-04-13 13:47
好像没有画椭圆或圆的。
|
|
6楼#
发布于:2006-04-13 11:48
<P>sample里面有的</P>
|
|