⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 toolbar背景变换.txt

📁 电子书籍,里面有丰富的文章和精神的营养,
💻 TXT
字号:
                    变换Toolbar即工具栏的背景

   由于VC++生成工程文件的工具栏Toolbar只有16色,许多时候满足不了要求,所以需要另想办法
   先生成一个工程文件(带Toolbar)
         1、新建一个单文档的MFC AppWizard(exe)(其余选项不变)
         2、然后Insert(插入)一个作为工具栏Toolbar背景的bmp图片(任意),并设置好其ID号。
         3、在MainFrm.h文件中
protected:
        
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP();
中protected:后加上CBitmap m_bmToolbarHi;即
protected:
        CBitmap m_bmToolbarHi;
	//{{AFX_MSG(CMainFrame)
	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
		// NOTE - the ClassWizard will add and remove member functions here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP();
         4、再在MainFrm.cpp中的CMainFrame::~CMainFrame()函数中加入
               m_bmToolbarHi.DeleteObject(); 即
CMainFrame::~CMainFrame()
{
//===========================================
m_bmToolbarHi.DeleteObject(); 
//===========================================        
}
         5、再在CMainFrame::OnCreate()函数中的
if (!m_wndStatusBar.Create(this) ||
		!m_wndStatusBar.SetIndicators(indicators,
		  sizeof(indicators)/sizeof(UINT)))
	{
		TRACE0("Failed to create status bar\n");
		return -1;      // fail to create
	}
前加上
	m_bmToolbarHi.LoadBitmap( IDB_TOOLBARHI );
	m_wndToolBar.SetBitmap( (HBITMAP)m_bmToolbarHi );
其中IDB_TOOLBARHI为新背景bmp的ID。
        结束。

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -