读书人

CListView如何添加背景用ListCtrl.S

发布时间: 2012-06-05 13:54:06 作者: rapoo

CListView怎么添加背景,用ListCtrl.SetBkImage为啥没有反应??
我是在单文档中分割出的一个子视图,然后类视图用的类是class CLeftList : public CListView
在设置背景图片的时候用的是ListCtrl.SetBkImage
是在OnInitialUpdate()这个方法中调用SetBkImage这个函数的,以前做过类的内容,在源文件的菜单响应函数里调用设置背景都可以成功,不知道为啥这次怎么尝试都不可以,原理不是很清楚,求高手解答

贴图部分代码如下:

CListCtrl &listCtrl= GetListCtrl();
CBitmap bitmap;
bitmap.LoadBitmap(IDB_BITMAP5);
listCtrl.SetBkImage(HBITMAP(bitmap));

运行出来没有反应,求高手解答~~~拜谢了

[解决办法]
Because CListCtrl::SetBkImage makes use of OLE COM functionality, the OLE libraries must be initialized before using SetBkImage. It is best to initialize the COM libraries when the application is initialized and uninitialize the libraries when the application terminates. This is automatically done in MFC applications that make use of ActiveX technology, OLE Automation, OLE Linking/Embedding, or ODBC/DAO operations.

[解决办法]
又发一遍?
[解决办法]
先初始化com库.

读书人网 >VC/MFC

热点推荐