@@ -319,9 +319,7 @@ TDzHTMLText = class(
319319 private
320320 FAbout: string;
321321
322- { $IFDEF FMX}
323322 FirstRebuild: Boolean;
324- { $ENDIF}
325323
326324 VisualItems: TDHVisualItemList;
327325
@@ -516,6 +514,8 @@ TDzHTMLText = class(
516514
517515 property Text: string read GetText write SetText;
518516
517+ function GetRealColor (Color: TAnyColor): TAnyColor;
518+
519519 class function UnescapeHTMLToText (const aHTML: string): string;
520520 class function EscapeTextToHTML (const aText: string): string;
521521 published
@@ -691,7 +691,7 @@ implementation
691691 , Winapi.GDIPOBJ, Winapi.GDIPAPI
692692{ $ENDIF} ;
693693
694- const STR_VERSION = ' 6.8 ' ;
694+ const STR_VERSION = ' 6.9 ' ;
695695
696696const DEFAULT_PPI = 96 ;
697697
@@ -945,7 +945,7 @@ procedure TDzHTMLText.Loaded;
945945 is not fired, because there is nothing to load. The Loaded is only fired
946946 when loading component that already has saved properties on DFM file.}
947947 inherited ;
948- Rebuild;
948+ // Rebuild - now in Paint event (just once)
949949end ;
950950
951951procedure TDzHTMLText.Modified (Flags: TDHModifiedFlags);
@@ -1245,13 +1245,21 @@ procedure TDzHTMLText.Resize;
12451245 inherited ;
12461246end ;
12471247
1248+ function TDzHTMLText.GetRealColor (Color: TAnyColor): TAnyColor;
1249+ begin
1250+ { $IF Defined(DCC) and Defined(VCL)}
1251+ if (Color<>clNone) and (seFont in StyleElements) { and not (csDesigning in ComponentState)} then
1252+ Result := StyleServices.GetSystemColor(Color)
1253+ else
1254+ { $ENDIF}
1255+ Result := Color;
1256+ end ;
1257+
12481258procedure TDzHTMLText.Paint ;
12491259begin
12501260 inherited ;
12511261
1252- { $IFDEF FMX}
12531262 if not FirstRebuild then Rebuild;
1254- { $ENDIF}
12551263
12561264 ExecPaint;
12571265end ;
@@ -1314,8 +1322,8 @@ procedure TDzHTMLText.CanvasProcess(C: TCanvas);
13141322 C.Brush.Color := GetColorresolvingParent
13151323 else
13161324 { $ELSE}
1317- if TStyleManager.IsCustomStyleActive and (seClient in StyleElements) and not (csDesigning in ComponentState) then
1318- C.Brush.Color := TStyleManager.ActiveStyle.GetStyleColor(TStyleColor.scWindow )
1325+ if (seClient in StyleElements) { and not (csDesigning in ComponentState)} then
1326+ C.Brush.Color := StyleServices.GetSystemColor(Color )
13191327 else
13201328 { $ENDIF}
13211329 C.Brush.Color := Color;
@@ -1353,14 +1361,13 @@ procedure TDzHTMLText.Paint_VisualItem(W: TDHVisualItem; C: TCanvas);
13531361begin
13541362 R := W.Rect;
13551363
1356- DefineFillColor(C, W.BColor);
1364+ DefineFillColor(Self, C, W.BColor);
13571365
13581366 if W is TDHVisualItem_Word then
13591367 begin
13601368 C.Font.Assign(TDHVisualItem_Word(W).Font);
1361- { $IFDEF FMX}
1362- C.Stroke.Color := TDHVisualItem_Word(W).FontColor;
1363- { $ENDIF}
1369+ DefineFontColor(Self, C,
1370+ { $IFDEF FMX} TDHVisualItem_Word(W).FontColor{ $ELSE} C.Font.Color{ $ENDIF} );
13641371 end ;
13651372
13661373 if Assigned(W.Link) then
@@ -1437,14 +1444,14 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
14371444 begin
14381445 if (Side.Thick=0 ) or (Side.Color=clNone) then Exit;
14391446
1440- DefineFillColor(C, Side.Color);
1447+ DefineFillColor(Self, C, Side.Color);
14411448 GenericFillRect(Self, C, TAnyRect.Create(TAnyPoint.Create(R.Left+X, R.Top+Y), W, H));
14421449 end ;
14431450
14441451begin
14451452 if W.OuterColor<>clNone then
14461453 begin
1447- DefineFillColor(C, W.OuterColor);
1454+ DefineFillColor(Self, C, W.OuterColor);
14481455 GenericFillRect(Self, C, R);
14491456 end ;
14501457
@@ -1456,7 +1463,8 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
14561463 if W.CornerRadius>0 then
14571464 begin
14581465 { $IFDEF USE_GDI}
1459- PaintRoundRectangleUsingWindowsGDI(C, W.Left.Thick, W.CornerRadius, R, W.Left.Color, W.InnerColor);
1466+ PaintRoundRectangleUsingWindowsGDI(C, W.Left.Thick, W.CornerRadius, R,
1467+ GetRealColor(W.Left.Color), GetRealColor(W.InnerColor));
14601468 { $ELSE}
14611469 if (W.Left.Thick>0 ) and (W.Left.Color<>clNone) then
14621470 begin
@@ -1466,7 +1474,7 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
14661474 C.Stroke.Kind := TBrushKind.{ $IF CompilerVersion >= 27}{ XE6} Solid{ $ELSE} bkSolid{ $ENDIF} ;
14671475 { $ELSE}
14681476 C.Pen.Width := W.Left.Thick;
1469- C.Pen.Color := W.Left.Color;
1477+ C.Pen.Color := GetRealColor( W.Left.Color) ;
14701478 C.Pen.Style := psSolid;
14711479 { $ENDIF}
14721480 end else
@@ -1478,7 +1486,7 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
14781486 { $ENDIF}
14791487 end ;
14801488
1481- DefineFillColor(C, W.InnerColor);
1489+ DefineFillColor(Self, C, W.InnerColor);
14821490
14831491 { $IFDEF FMX}
14841492 C.FillRect(R, W.CornerRadius, W.CornerRadius, AllCorners, Opacity); // backgound
@@ -1491,7 +1499,7 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
14911499 begin
14921500 if W.InnerColor<>clNone then
14931501 begin
1494- DefineFillColor(C, W.InnerColor);
1502+ DefineFillColor(Self, C, W.InnerColor);
14951503 GenericFillRect(Self, C, R);
14961504 end ;
14971505
@@ -1568,14 +1576,14 @@ procedure TDzHTMLText.Paint_Line(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Line)
15681576 if W.ColorAlt <> clNone then
15691577 R.Height := RoundIfVCL(R.Height / 2 ); // half height when double color
15701578
1571- DefineFillColor(C, W.Color);
1579+ DefineFillColor(Self, C, W.Color);
15721580 GenericFillRect(Self, C, R);
15731581
15741582 if W.ColorAlt <> clNone then
15751583 begin
15761584 R.Offset(0 , R.Height);
15771585
1578- DefineFillColor(C, W.ColorAlt);
1586+ DefineFillColor(Self, C, W.ColorAlt);
15791587 GenericFillRect(Self, C, R);
15801588 end ;
15811589end ;
@@ -1957,8 +1965,8 @@ procedure TDHStyleLinkProp.SetUnderline(const Value: Boolean);
19571965
19581966procedure TDHStyleLinkProp.SetPropsToCanvas (C: TCanvas);
19591967begin
1960- if FFontColor<>clNone then DefineFontColor(C, FFontColor);
1961- if FBackColor<>clNone then DefineFillColor(C, FBackColor);
1968+ if FFontColor<>clNone then DefineFontColor(Lb, C, FFontColor);
1969+ if FBackColor<>clNone then DefineFillColor(Lb, C, FBackColor);
19621970 if FUnderline then C.Font.Style := C.Font.Style + [TMyFontStyle.fsUnderline];
19631971end ;
19641972
0 commit comments