How to change the color of the listcolumns sub-window in listview, it is always gray

Source: Internet
Author: User
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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.