'Use the SetFileName property to set the location of the
'image to use as the symbol
bmpSym.SetFileName App.Path & "\VBeye.gif"
Set Map1.Layers(0).Symbol.Custom = bmpSym
End Sub
下面实现mo的一个接口AFCustom
Option Explicit
'Indicate that this class will implement ICustomMarker
'Remember that you must first browse for the type library
Implements AFCustom.ICustomMarker
'Internal data members
Private m_filename As String
Private m_dpi As Double
Private m_picture As IPicture
'External method which allows users to specify the
'image path and name to be rendered.
Public Sub SetFileName(fn As String)
m_filename = fn
End Sub
'The draw method. This method is called for each symbol.
Private Sub ICustomMarker_Draw(ByVal hDC As Long, ByVal x As Long, ByVal y As Long)
Dim pixWidth As Double, pixHeight As Double
'Convert the picture width (normally in HI_METRIC) to pixels
'using the previously stored dpi member.
pixWidth = m_picture.Width * m_dpi / 2540
pixHeight = m_picture.Height * m_dpi / 2540
'Always check for a valid interface before using it.
If Not m_picture Is Nothing Then
'Render the picture, centered on the given point.
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
'This method is called once per refresh, at the completion of rendering.
Private Sub ICustomMarker_ResetDC(ByVal hDC As Long)
'Set the picture object to nothing, free all resources.
Set m_picture = Nothing
End Sub
'This method is called once per refresh, prior to rendering.
Private Sub ICustomMarker_SetupDC(ByVal hDC As Long, ByVal dpi As Double, ByVal pBaseSym As Object)
'Store the dots per inch.
m_dpi = dpi
'Try to load the specified picture.
Set m_picture = LoadPicture(m_filename)
End Sub
我给你提供一个思路:把你的符号做成truetype的字体归为某个字体,它就在这个字体里面有了一个索引号,然后把你的symbol的属性设置好:比如你做的符号添加到“Arial”字体里,索引号为122。
那么: dim fnt as font
font.name="arail"
set symbol.font=fnt
symbol.characterindex=122
然后你就可以画出此符号了。这只是大概代码