简体   繁体   中英

Is there a way to change text background color of the items in Windows Explorer in Windows 7?

http://screenshots.en.sftcdn.net/en/scrn/39000/39972/xentient-labels-1.jpg

Is is possible to change background color of the items in Windows Explorer like the Xentient Labels application does ? Is it possible to do so from Delphi XE2 in Windows 7 ?

It's not possible to do this in Windows 7 since the Windows Explorer's list view uses the DirectUIHWND not SysListView32 as it was in Windows XP. The DirectUIHWND class control doesn't listen the list view messages, so you cannot use the ListView_SetTextBkColor macro to change text back color as you could on Windows XP.

With the following simple test you can verify it. Let's have an edit box and button on the form. In that edit box enter the handle to the Windows Explorer's list view control (obtained eg by Spy++) and in button's press run the following code:

uses
  Winapi.CommCtrl;

procedure TForm1.Button1Click(Sender: TObject);
var
  ListViewHandle: HWND;
begin
  ListViewHandle := StrToInt(Edit1.Text);
  ListView_SetTextBkColor(ListViewHandle, $0000CCFF);
end;

This Spy++ screenshot from Windows 7 shows the class name of the Explorer's list view (in Windows XP it was SysListView32 controllable by standard list view messages, the DirectUIHWND doesn't react to them).

在此输入图像描述

You can't color text, but you can add overlays like TortoiseSVN/CVS/Git/Groove/Dropbox/etc. does.

带覆盖图标的资源管理器截图

(from https://tortoisesvn.net/screenshots.html )

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM