水世界-水处理技术社区(论坛)

 找回密码
 注册

QQ登录

只需一步,快速开始

用微信登录

扫一扫,用微信登录

搜索
查看: 1355|回复: 0
打印 上一主题 下一主题

AO在线上画注记

[复制链接]

1万

积分

5860

金钱

4894

帖子

铂金水师

QQ
跳转到指定楼层
楼主
发表于 2007-9-21 14:34:09 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式



马上注册并关注水世界微信号,获得更多资料

您需要 登录 才可以下载或查看,没有帐号?注册   扫一扫,用微信登录

x
Imports ESRI.ArcGIS.Geometry Imports ESRI.ArcGIS.Carto Imports ESRI.ArcGIS.MapControl Imports ESRI.ArcGIS.Display OnAfterDraw: Dim pTextSymbol As ITextSymbol = New TextSymbol Dim pFont As stdole.StdFont pFont = New stdole.StdFont pFont.Name = "Arial" pFont.Bold = True pFont.Size = 16 pTextSymbol.Font = pFont pTextSymbol.HorizontalAlignment = esriTextHorizontalAlignment.esriTHAFull Dim rgbcolor As IRgbColor = New RgbColor rgbcolor.RGB = RGB(0, 0, 255) pTextSymbol.Color = rgbcolor Dim pTextPath As ITextPath Dim pSimpleTextSymbol As ISimpleTextSymbol 'Create a text path and grab hold of the ITextPath interface pTextPath = New BezierTextPath 'to spline the text pSimpleTextSymbol = pTextSymbol 'Grab hold of the ISimpleTextSymbol interface through the ITextSymbol interface pSimpleTextSymbol.TextPath = pTextPath 'Set the text path of the simple text symbol 'Draw the line object and spline the user text around the line m_Line = rotatezj(m_Line) '文字位置的自适应调整 AxMapControl1.DrawText(m_Line, "ssfsfsfsfsfsf", pTextSymbol) '当线的起点位于终点的右侧时,线将以相反方向重新绘制,确保文字自动显示在线的上方 Private Function rotatezj(ByVal line As Polyline) As Polyline Try Dim ilinetmp As IPolyline Dim linetmp As Polyline = New Polyline Dim pt0x, pt0y, pt1x, pt1y As Double Dim pt0, pt1 As IPoint If line Is Nothing Then Return line : Exit Try If line.PointCount < 2 Then Return line : Exit Try pt0 = line.Point(0) pt1 = line.Point(line.PointCount - 1) AxMapControl1.FromMapPoint(pt0, pt0x, pt0y) AxMapControl1.FromMapPoint(pt1, pt1x, pt1y) If pt0x < pt1x Then Return line : Exit Function ilinetmp = linetmp If pt0x > pt1x Then '需要转换 linetmp = New Polyline Dim length As Integer = line.PointCount For i As Integer = length - 1 To 0 Step -1 linetmp.AddPoint(line.Point(i)) Next End If Return linetmp Catch ex As Exception MsgBox(ex.Message) End Try End Function
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 转播转播 分享分享 分享淘帖 支持支持 反对反对
您需要登录后才可以回帖 登录 | 注册   扫一扫,用微信登录

本版积分规则

联系管理员|手机版|小黑屋|水世界-水处理技术社区(论坛) ( 京ICP备12048982号-4

GMT+8, 2025-5-15 08:55 , Processed in 0.125916 second(s), 35 queries .

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表