@@ -9,7 +9,7 @@ interface
99uses
1010 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
1111 Dialogs, ImgList, VirtualTrees, StdCtrls, ExtCtrls, VirtualTrees.BaseTree, System.ImageList,
12- VirtualTrees.Types;
12+ VirtualTrees.Types, VirtualTrees.BaseAncestorVCL, VirtualTrees.AncestorVCL ;
1313
1414type
1515 THeaderOwnerDrawForm = class (TForm)
@@ -96,7 +96,7 @@ procedure THeaderOwnerDrawForm.HeaderCustomDrawTreeAdvancedHeaderDraw(Sender: TV
9696 Size: TSize;
9797 SourceRect,
9898 TargetRect: TRect;
99-
99+ OldFont: TFont;
100100begin
101101 with PaintInfo do
102102 begin
@@ -142,15 +142,25 @@ procedure THeaderOwnerDrawForm.HeaderCustomDrawTreeAdvancedHeaderDraw(Sender: TV
142142 end ;
143143 if hpeText in Elements then
144144 begin
145- TargetCanvas.Font.Name := ' Webdings' ;
146- TargetCanvas.Font.Charset := SYMBOL_CHARSET;
147- TargetCanvas.Font.Size := 60 ;
148- if IsHoverIndex then
149- TargetCanvas.Font.Color := $80FF;
150- S := ' û' ;
151- Size := TargetCanvas.TextExtent(S);
152- SetBkMode(TargetCanvas.Handle, TRANSPARENT);
153- TargetCanvas.TextOut(PaintRectangle.Left + 10 , Paintrectangle.Bottom - Size.cy, S);
145+ // store current font
146+ OldFont := TFont.Create();
147+ try
148+ OldFont.Assign(TargetCanvas.Font);
149+ // draw world map
150+ TargetCanvas.Font.Name := ' Webdings' ;
151+ TargetCanvas.Font.Charset := SYMBOL_CHARSET;
152+ TargetCanvas.Font.Size := 60 ;
153+ if IsHoverIndex then
154+ TargetCanvas.Font.Color := $80FF;
155+ S := ' û' ;
156+ Size := TargetCanvas.TextExtent(S);
157+ SetBkMode(TargetCanvas.Handle, TRANSPARENT);
158+ TargetCanvas.TextOut(PaintRectangle.Left + 10 , Paintrectangle.Bottom - Size.cy, S);
159+ // restore previous font
160+ TargetCanvas.Font.Assign(OldFont);
161+ finally
162+ OldFont.Free();
163+ end ;
154164 end ;
155165 // Other elements go here.
156166 end ;
0 commit comments