Kaynağa Gözat

Add VCL styling support.

Martijn Laan 5 ay önce
ebeveyn
işleme
b367bb19ff
1 değiştirilmiş dosya ile 10 ekleme ve 1 silme
  1. 10 1
      Components/FolderTreeView.pas

+ 10 - 1
Components/FolderTreeView.pas

@@ -134,7 +134,7 @@ implementation
 }
 
 uses
-  PathFunc, ShellApi, NewUxTheme, Types;
+  PathFunc, ShellApi, NewUxTheme, Types, Themes;
 
 const
   SHPPFW_NONE = $00000000;
@@ -390,6 +390,15 @@ begin
       TVS_EX_DOUBLEBUFFER);
   end;
 
+  { Initialize style colors }
+  var LStyle := StyleServices;
+  if not LStyle.Enabled or LStyle.IsSystemStyle then
+    LStyle := nil;
+  if (LStyle <> nil) and (seClient in StyleElements) then begin
+    TreeView_SetBkColor(Handle, ColorToRGB(LStyle.GetStyleColor(scTreeview)));
+    TreeView_SetTextColor(Handle, ColorToRGB(LStyle.GetStyleFontColor(sfTreeItemTextNormal)));
+  end;
+
   { Initialize the image list }
   ImageList := SHGetFileInfo('', 0, FileInfo, SizeOf(FileInfo),
     SHGFI_USEFILEATTRIBUTES or SHGFI_SYSICONINDEX or SHGFI_SMALLICON);