看MSDN Sets the background image in a list-view control. You can send this message explicitly or by using the ListView_SetBkImage macro. Syntax To send this message, call the SendMessage function as follows. lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) LVM_SETBKIMAGE, // message ID (WPARAM) wParam, // = 0; not used, must be zero (LPARAM) lParam // = (LPARAM) (LPLVBKIMAGE) plvbki; ); ParameterswParam Must be zero. plvbki Pointer to a LVBKIMAGE structure that contains the new background image information. Return ValueReturns nonzero if successful, or zero otherwise.ResBecause the list-view control uses OLE COM to manipulate the background images, the calling application must call CoInitialize or OleInitialize before sending this message. It is best to call one of these functions when the application is initialized and call either CoUninitialize or OleUninitialize when the application is terminating.
ListView1.Picture = Image1.Picture
当然了,你也可以用LOADPICTURE方法来加载资源文件中的或者磁盘上的图片
写在哪里???
Private Sub Form_Load()
'这个ListView1就是您老的LV,这个Image1就是您老的Image控件
ListView1.Picture = Image1.Picture
End Sub
世界上并不是所有软件都是VB编的,
就算都是用VB写的,难道VB只能编一个软件吗?
对另一进程里的LV就Game Over了吗?
但偶连CoInitialize的定义都找不到,
诶,VB就是VB啊
可以用sendMessage实现
Sets the background image in a list-view control. You can send this message explicitly or by using the ListView_SetBkImage macro. Syntax
To send this message, call the SendMessage function as follows.
lResult = SendMessage( // returns LRESULT in lResult (HWND) hWndControl, // handle to destination control (UINT) LVM_SETBKIMAGE, // message ID (WPARAM) wParam, // = 0; not used, must be zero (LPARAM) lParam // = (LPARAM) (LPLVBKIMAGE) plvbki; );
ParameterswParam
Must be zero.
plvbki
Pointer to a LVBKIMAGE structure that contains the new background image information.
Return ValueReturns nonzero if successful, or zero otherwise.ResBecause the list-view control uses OLE COM to manipulate the background images, the calling application must call CoInitialize or OleInitialize before sending this message. It is best to call one of these functions when the application is initialized and call either CoUninitialize or OleUninitialize when the application is terminating.
LVBKIMAGE 这个结构里,只能用 URL,
就是说只能从文件载入图片,
但偶要的是载入内存中的图片 :)
一秒钟更新一次,难道也要保存文件再读取?
如果被禁止写盘了,怎么办?据观察,现在有很多使用SysListView的软件,都能显示动态背景图的。
好像没有迹象表明它们是读取文件的。不知道它们又是怎么做到的呢?都是LV,难道只有VB才做不到吗?诶,郁闷即使不说其它软件,就算VB自己Common 6.0版的LV 控件也有现成的Picture属性。
大家知道这个属性是可以使用内存图像的,而不一定非要从磁盘载入。
不也是封装的LV嘛,VB又是怎么做到的呢?