将位图图标放置在菜单中VB源码程序 - vb源码程序 - 谷速源码
下载频道> 资源分类> 编程语言> VB源码> 将位图图标放置在菜单中VB源码程序

标题:将位图图标放置在菜单中VB源码程序
分享到:

所属分类: VB源码 资源类型: 文件大小: 4.24 KB 上传时间: 2016-01-20 23:07:14 下载次数: 6 资源积分:1分 提 供 者: vb源码代做 20160120110653865
内容:
将位图图标放置在菜单中VB源码程序,程序员在编程的过程中可以参考学习使用,希望对IT程序员有用,此源码程序简单易懂、方便阅读,有很好的学习价值!
部分代码如下:
VERSION 5.00
Begin VB.Form Form1 
   Caption         =   "将图标放置到菜单栏"
   ClientHeight    =   1860
   ClientLeft      =   1140
   ClientTop       =   1800
   ClientWidth     =   4605
   LinkTopic       =   "Form1"
   PaletteMode     =   1  'UseZOrder
   ScaleHeight     =   1860
   ScaleWidth      =   4605
   Begin VB.Image imCopy 
      Height          =   195
      Left            =   3600
      Picture         =   "menubmp.frx":0000
      Top             =   600
      Visible         =   0   'False
      Width           =   225
   End
   Begin VB.Image imPrintSetup 
      Height          =   225
      Left            =   3000
      Picture         =   "menubmp.frx":0512
      Top             =   600
      Visible         =   0   'False
      Width           =   180
   End
   Begin VB.Image imPrint 
      Height          =   210
      Left            =   2280
      Picture         =   "menubmp.frx":0A08
      Top             =   600
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Image imSave 
      Height          =   210
      Left            =   1680
      Picture         =   "menubmp.frx":0F2A
      Top             =   600
      Visible         =   0   'False
      Width           =   210
   End
   Begin VB.Image imOpen 
      Height          =   195
      Left            =   1080
      Picture         =   "menubmp.frx":144C
      Top             =   600
      Visible         =   0   'False
      Width           =   240
   End
   Begin VB.Menu mnuFile 
      Caption         =   "文件"
      Begin VB.Menu mnuOpen 
         Caption         =   "&Open"
      End
      Begin VB.Menu mnuSave 
         Caption         =   "&Save"
      End
      Begin VB.Menu Sep1 
         Caption         =   "-"
      End
      Begin VB.Menu mnuPrint 
         Caption         =   "&Print"
      End
      Begin VB.Menu mnuPrintSetup 
         Caption         =   "Print &Setup"
      End
   End
   Begin VB.Menu mnuEdit 
      Caption         =   "编辑"
      Begin VB.Menu mnuExtra 
         Caption         =   "二级菜单"
         Begin VB.Menu mnuCopy 
            Caption         =   "复制"
         End
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
 
 
Option Explicit
 
' MenuBmp sample by Matt Hart - mhart@taascforce.com
' http://www.webczar.com/defcon/mh/vbhelp.html
' http://www.webczar.com/defcon/mh
'
' This sample shows you how to add bitmaps to your
' menu items.  First, you must retrieve the VB menu handle
' with the GetMenu API call.  Then, you set the Unchecked and
' Checked bitmaps (I don't differentiate between the two
' with this example - usually you would put a checkmark in
' the bitmap and use that for Checked).
'
' Note that the Picture property of an Image control (or
' a Picture control) is the Bitmap Handle, this the Image
' controls can be used like a bitmap resource.
'
' I also have one sub menu so that you can see how getting
' submenu handles and item positions works.
 
Private Declare Function GetMenu Lib "user32" _
   (ByVal hwnd As Long) As Long
 
Private Declare Function GetSubMenu Lib "user32" _
   (ByVal hMenu As Long, ByVal nPos As Long) As Long
 
Private Declare Function SetMenuItemBitmaps Lib "user32" _
   (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, _
    ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long
 
Const MF_BYPOSITION = &H400&
 
' VB 5 doesn't need this declration, but VB 4 does.
' Private Declare Function VarPtr Lib "VB40032.DLL" (variable As Any) As Long
 
Private Sub Form_Load()
    Dim mHandle As Long, lRet As Long, sHandle As Long, sHandle2 As Long
    mHandle = GetMenu(hwnd)
    sHandle = GetSubMenu(mHandle, 0)
    lRet = SetMenuItemBitmaps(sHandle, 0, MF_BYPOSITION, imOpen.Picture, imOpen.Picture)
    lRet = SetMenuItemBitmaps(sHandle, 1, MF_BYPOSITION, imSave.Picture, imSave.Picture)
    lRet = SetMenuItemBitmaps(sHandle, 3, MF_BYPOSITION, imPrint.Picture, imPrint.Picture)
    lRet = SetMenuItemBitmaps(sHandle, 4, MF_BYPOSITION, imPrintSetup.Picture, imPrintSetup.Picture)
    sHandle = GetSubMenu(mHandle, 1)
    sHandle2 = GetSubMenu(sHandle, 0)
    lRet = SetMenuItemBitmaps(sHandle2, 0, MF_BYPOSITION, imCopy.Picture, imCopy.Picture)
End Sub
 

文件列表(点击上边下载按钮,如果是垃圾文件请在下面评价差评或者投诉):

将位图图标放置在菜单中VB源码程序/
将位图图标放置在菜单中VB源码程序/MENUBMP.FRX
将位图图标放置在菜单中VB源码程序/MSSCCPRJ.SCC
将位图图标放置在菜单中VB源码程序/Menubmp.vbp
将位图图标放置在菜单中VB源码程序/Menubmp.vbw
将位图图标放置在菜单中VB源码程序/menubmp.frm
将位图图标放置在菜单中VB源码程序/谷速说明.txt

关键词: 位图 图标 源码

编程语言下载排行

Top_arrow
回到顶部
联系方式| 版权声明| 招聘信息| 广告服务| 银行汇款| 法律顾问| 兼职技术| 付款方式| 关于我们|
网站客服网站客服 程序员兼职招聘 程序员兼职招聘
沪ICP备19040327号-3
公安备案号:沪公网安备 31011802003874号
库纳格流体控制系统(上海)有限公司 版权所有
Copyright © 1999-2014, GUSUCODE.COM, All Rights Reserved