VB打造超酷个性化菜单(二)(4)
中华网科技 http://tech.china.com
2005-07-01 13:31:33
|
|
|
‘ 删除菜单项
Public Sub DeleteItem(ByVal itemAlias As String)
Dim i As Long
For i = 0 To UBound(MyItemInfo)
If MyItemInfo(i).itemAlias = itemAlias Then
DeleteMenu hMenu, i, 0
Exit For
End If
Next i
End Sub
‘ 弹出菜单
Public Sub PopupMenu(ByVal x As Long, ByVal y As Long, ByVal Align As PopupAlign)
TrackPopupMenu hMenu, Align, x, y, 0, frmMenu.hwnd, ByVal 0
End Sub
‘ 设置菜单项图标
Public Sub SetItemIcon(ByVal itemAlias As String, ByVal itemIcon As StdPicture)
Dim i As Long
For i = 0 To UBound(MyItemInfo)
If MyItemInfo(i).itemAlias = itemAlias Then
Set MyItemInfo(i).itemIcon = itemIcon
Exit For
End If
Next i
End Sub
‘ 获得菜单项图标
Public Function GetItemIcon(ByVal itemAlias As String) As StdPicture
Dim i As Long
For i = 0 To UBound(MyItemInfo)
If MyItemInfo(i).itemAlias = itemAlias Then
Set GetItemIcon = MyItemInfo(i).itemIcon
Exit For
End If
Next i
End Function
‘ 设置菜单项文字
Public Sub SetItemText(ByVal itemAlias As String, ByVal itemText As String)
Dim i As Long
For i = 0 To UBound(MyItemInfo)
If MyItemInfo(i).itemAlias = itemAlias Then
MyItemInfo(i).itemText = itemText
Exit For
End If
Next i
End Sub
‘ 获得菜单项文字
Public Function GetItemText(ByVal itemAlias As String) As String
Dim i As Long
For i = 0 To UBound(MyItemInfo)
If MyItemInfo(i).itemAlias = itemAlias Then
GetItemText = MyItemInfo(i).itemText
Exit For
End If
Next i
End Function
首页 上页 | ...1| 2 | 3 | 4 | 下页 尾页 共 4 页
|