阅读:3858回复:5
在mo中用位图标注point对象!!
先定义一个类模块(MyCustomSymbol,确定引用AFCustom对象)
Implements AFCustom.ICustomMarker Private m_filename As String Private m_dpi As Double Private m_picture As IPicture Public Sub SetFileName(fn As String) m_filename = fn End Sub Private Sub ICustomMarker_Draw(ByVal hDC As Long, ByVal x As Long, ByVal y As Long) Dim pixWidth As Double, pixHeight As Double pixWidth = m_picture.Width * m_dpi / 2540 pixHeight = m_picture.Height * m_dpi / 2540 If Not m_picture Is Nothing Then m_picture.Render hDC, x - pixWidth / 2, y + pixWidth / 2, pixWidth, -pixHeight, _ 0, 0, m_picture.Width, m_picture.Height, Null End If End Sub Private Sub ICustomMarker_ResetDC(ByVal hDC As Long) Set m_picture = Nothing End Sub Private Sub ICustomMarker_SetupDC(ByVal hDC As Long, ByVal dpi As Double, ByVal pBaseSym As Object) m_dpi = dpi Set m_picture = LoadPicture(m_filename) End Sub 然后在窗体里面可以使用这个类模块: Private Sub Form_Load() Dim bmpSym As New MyCustomSymbol Dim lyr As New MapLayer Set lyr = Map1.Layers(0) bmpSym.SetFileName "C:\Documents and Settings\cgh\My Documents\My Pictures\1.bmp" Debug.Print Map1.Layers(0).shapeType If Map1.Layers(0).shapeType = 21 Then Set lyr.Symbol.Custom = bmpSym End If End Sub |
|
1楼#
发布于:2003-07-27 10:55
兄弟多来发发
不错不错! |
|
|
3楼#
发布于:2003-08-26 15:27
哈哈,AFCustom对象怎么引用?
|
|
|
4楼#
发布于:2003-08-26 17:45
顶!
|
|
5楼#
发布于:2003-08-26 17:48
位图很可能盖住地图了,不知道能不能使其透明,只剩下字和对象.
|
|
6楼#
发布于:2003-10-13 09:14
很好,能不能再讲一讲如何使用字体以及用什么工具使用字体啊?谢谢!
|
|