How to change the color of the listcolumns sub-window in listview, which has always been a gray VCL Component Development and Application
Http://www.delphi2007.net/DelphiVCL/html/delphi_20061222091101203.html
I found an answer in C ++ builder to re-draw the sub-window, but the call failed after I translated it into Delphi. Who did it with Delphi? Source code , Paste it
I 'd like to give you a special topic on customizing the listview style, which is very good, with sample source code.
Http://www.delphidabbler.com/articles? Article = 16
The example provided here does not seem to have changed the color of listcolumns. I want to change the background color of columns in listview, such as blue.
Fheaderinstance: pointer; // an instance of listview colums
Fdefheaderproc: pointer; // main function of listview colums
Fheaderhandle: hwnd; // handle
////////////////////
Initialization:
Fheaderinstance: = classes. makeobjectinstance (headerwndproc );//
//////////////
// Subclass the primary function of columns to fdefheaderproc
Procedure tmylistview. wmparentnotify (VAR message: twmparentnotify );
Begin
Inherited;
With message do
If (event = wm_create) and (fheaderhandle = 0) then
Begin
Fheaderhandle: = childwnd;
Fdefheaderproc: = pointer (getwindowlong (fheaderhandle, gwl_wndproc ));
Setwindowlong (fheaderhandle, gwl_wndproc, longint (fheaderinstance ));
End;
End;
////////////
Message Processing
Procedure tfsskinlistview. headerwndproc (VAR message: tmessage );
Procedure defaultproc;
Begin
With message do
Result: = callwindowproc (fdefheaderproc, fheaderhandle, MSG, wparam, lparam );
End;
Begin
With message do
Begin
Case MSG
Wm_erasebkgnd: Result: = 1;
Wm_lbuttondown :;
Wm_lbuttonup :;
Wm_mouseleave :;
Wm_mousemove :;
Wm_paint :;
Begin
Draw the image you want here.
End;
Hdm_layout:
End
Else
Defaultproc;
End;
End;
Procedure tfsskinlistview. headerwndproc (VAR message: tmessage );
///////
Correction
Tmylistview. headerwndproc (VAR message: tmessage );
Can I change the color of listcolumns only when I create a new class? Is there any other way?