酷工具条按钮


日期: 2001-12-06 14:00 | 联系我
关注我: Telegram, Twitter

如果希望添加象Internet Explorer中的酷工具条,现在做起来就比较容易了。本程序介绍其设计方法。

在工具条用CMainFrame::OnCreate()创建后,需要添加下面代码,但前提是需要创建两组位图资源:IDB_TOOLBAR_COLD用于正常情况;IDB_TOOLBAR_HOT用于酷按钮情况。

// Set up hot bar image lists.

CImageList imageList;

CBitmap bitmap;

// Create and set the normal toolbar image list.

bitmap.LoadBitmap(IDB_TOOLBAR_COLD);

imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);

imageList.Add(&bitmap, RGB(255,0,255));

m_hotToolBar.SendMessage(TB_SETIMAGELIST, 0, (LPARAM)imageList.m_hImageList);

imageList.Detach();

bitmap.Detach();

// Create and set the hot toolbar image list.

bitmap.LoadBitmap(IDB_TOOLBAR_HOT);

imageList.Create(21, 20, ILC_COLORDDB|ILC_MASK, 13, 1);

imageList.Add(&bitmap, RGB(255,0,255));

m_hotToolBar.SendMessage(TB_SETHOTIMAGELIST, 0, (LPARAM)imageList.m_hImageList);

imageList.Detach();

bitmap.Detach();

其中,SendMessage是Visual C++ 6.0中的CToolBarCtrl类新增加的函数,而且还支持24位色,而不是以前的16色。

>>> DOWN !!! >>>下载源代码及演示程序


 文章评论
目前没有任何评论.

↓ 快抢占第1楼,发表你的评论和意见 ↓

当前页面是本站的 Google AMP 版本。
欲查看完整版本和发表评论请点击:完整版 »

 

程序员小辉 建站于 1997
Copyright © XiaoHui.com; 保留所有权利。