将VB译为delphi(100分)

孜孜

Unregistered / Unconfirmed
GUEST, unregistred user!
这是ARCgis engine 开发包中提供的一个VB示例,功能为将toolbarcontrol(工具条控件)中的功能,在mapcontrol(map控件)中,点鼠标右键实现快捷菜单功能。
这个例子为VB6.0,现想在delphi 7中实现,请多指导!

' Copyright 2006 ESRI
'
' All rights reserved under the copyright laws of the United States
' and applicable international laws, treaties, and conventions.
'
' You may freely redistribute and use this sample code, with or
' without modification, provided you include the original copyright
' notice and use restrictions.
'
' See use restrictions at /arcgis/developerkit/userestrictions.
Option Explicit
Private m_pToolbarMenu As IToolbarMenu
Private Sub Form_Load()
'Set buddy control
ToolbarControl1.SetBuddyControl MapControl1
'Create UID's and add new items to the ToolbarControl
Dim pUid As New UID
pUid.Value = "esriControls.ControlsOpenDocCommand"
ToolbarControl1.AddItem pUid, 0, 0, False, , esriCommandStyleIconAndText
pUid.Value = "esriControls.ControlsMapZoomInTool"
ToolbarControl1.AddItem pUid, , , True, , esriCommandStyleIconAndText
pUid.Value = "esriControls.ControlsMapZoomOutTool"
ToolbarControl1.AddItem pUid, , , , , esriCommandStyleIconAndText
pUid.Value = "esriControls.ControlsMapPanTool"
ToolbarControl1.AddItem pUid, , , , , esriCommandStyleIconAndText
pUid.Value = "esriControls.ControlsMapFullExtentCommand"
ToolbarControl1.AddItem pUid, , , , , esriCommandStyleIconAndText

'Create a MenuDef object
Dim pMenuDef As esriSystemUI.IMenuDef
Set pMenuDef = New NavigationMenu
'Create a new ToolbarMenu
Set m_pToolbarMenu = New ToolbarMenu
'Add the MenuDef to the ToolbarMenu
m_pToolbarMenu.AddItem pMenuDef
'Set the Toolbarmenu's hook
m_pToolbarMenu.SetHook ToolbarControl1.Object

End Sub
Private Sub MapControl1_OnMouseDown(ByVal button As Long, ByVal shift As Long, ByVal x As Long, ByVal y As Long, ByVal mapX Asdo
uble, ByVal mapY Asdo
uble)
If button = vbRightButton then
'Popup the menu
m_pToolbarMenu.PopupMenu x, y, MapControl1.hWnd
m_pToolbarMenu.p
End If
End Sub
 
难道没有人知道,提前一下?
 
顶部