@@ -35,6 +35,8 @@ interface
3535
3636{ $INCLUDE Types.inc}
3737type
38+ TMyFontStyle = TFontStyle;
39+
3840 TDzHTMLText = class ;
3941
4042 TDHLinkKind = (lkLinkRef, lkSpoiler);
@@ -678,9 +680,12 @@ implementation
678680 { $IFDEF MSWINDOWS}
679681 , Winapi.Windows, Winapi.ShellAPI
680682 { $ENDIF}
683+ { $ENDIF}
684+ { $IFDEF USE_GDI}
685+ , Winapi.GDIPOBJ, Winapi.GDIPAPI
681686{ $ENDIF} ;
682687
683- const STR_VERSION = ' 6.5 ' ;
688+ const STR_VERSION = ' 6.6 ' ;
684689
685690const DEFAULT_PPI = 96 ;
686691
@@ -1370,6 +1375,46 @@ procedure TDzHTMLText.Paint_VisualItem(W: TDHVisualItem; C: TCanvas);
13701375 raise EDHInternalExcept.Create(' Invalid visual item object' );
13711376end ;
13721377
1378+ { $IFDEF USE_GDI}
1379+ function ToGPColor (Color: TColor): TGPColor;
1380+ var
1381+ ColRef: COLORREF;
1382+ begin
1383+ ColRef := ColorToRGB(Color);
1384+ Result := MakeColor(GetRValue(ColRef), GetGValue(ColRef), GetBValue(ColRef));
1385+ end ;
1386+
1387+ procedure PaintRoundRectangleUsingWindowsGDI (Canvas: TCanvas; Thick, Radius: Single; Rect: TRect; PenColor, BrushColor: TColor);
1388+ var
1389+ Gpx: TGPGraphics;
1390+ Pen: TGPPen;
1391+ Path: TGPGraphicsPath;
1392+ Brush: TGPSolidBrush;
1393+ begin
1394+ Gpx := TGPGraphics.Create(Canvas.Handle);
1395+ Pen := TGPPen.Create(ToGPColor(PenColor), Thick);
1396+ Brush := TGPSolidBrush.Create(ToGPColor(BrushColor));
1397+ Path := TGPGraphicsPath.Create;
1398+ try
1399+ Gpx.SetSmoothingMode(SmoothingModeAntiAlias);
1400+
1401+ Path.AddArc(Rect.Left, Rect.Top, Radius, Radius, 180 , 90 );
1402+ Path.AddArc(Rect.Left + Rect.Width - Radius, Rect.Top, Radius, Radius, 270 , 90 );
1403+ Path.AddArc(Rect.Left + Rect.Width - Radius, Rect.Top + Rect.Height - Radius, Radius, Radius, 0 , 90 );
1404+ Path.AddArc(Rect.Left, Rect.Top + Rect.Height - Radius, Radius, Radius, 90 , 90 );
1405+ Path.CloseFigure;
1406+
1407+ if BrushColor<>clNone then Gpx.FillPath(Brush, Path);
1408+ if (PenColor<>clNone) and (Thick>0 ) then Gpx.DrawPath(Pen, Path);
1409+ finally
1410+ Path.Free;
1411+ Brush.Free;
1412+ Pen.Free;
1413+ Gpx.Free;
1414+ end ;
1415+ end ;
1416+ { $ENDIF}
1417+
13731418procedure TDzHTMLText.Paint_Div (C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
13741419
13751420 procedure PaintSide (var Side: TDHDivBorderLineAttrRec; X, Y, W, H: TPixels);
@@ -1394,6 +1439,9 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
13941439
13951440 if W.CornerRadius>0 then
13961441 begin
1442+ { $IFDEF USE_GDI}
1443+ PaintRoundRectangleUsingWindowsGDI(C, W.Left.Thick, W.CornerRadius, R, W.Left.Color, W.InnerColor);
1444+ { $ELSE}
13971445 if (W.Left.Thick>0 ) and (W.Left.Color<>clNone) then
13981446 begin
13991447 { $IFDEF FMX}
@@ -1422,6 +1470,7 @@ procedure TDzHTMLText.Paint_Div(C: TCanvas; R: TAnyRect; W: TDHVisualItem_Div);
14221470 { $ELSE}
14231471 C.RoundRect(R, W.CornerRadius, W.CornerRadius);
14241472 { $ENDIF}
1473+ { $ENDIF}
14251474 end else
14261475 begin
14271476 if W.InnerColor<>clNone then
@@ -1696,7 +1745,7 @@ function TDzHTMLText.CalcMulDiv(Size: Integer): Integer;
16961745{ $ENDIF}
16971746begin
16981747 { $IFDEF PPI_SCALING}
1699- if (ParentForm<>nil ) and THackForm(ParentForm).Scaled
1748+ if (ParentForm<>nil ) and THackForm(ParentForm).Scaled and (ParentForm.Monitor<> nil )
17001749 { $IFDEF DCC} and not (csDesigning in ComponentState){ $ENDIF} // design always based on Default PPI in Delphi
17011750 then
17021751 begin
@@ -1894,7 +1943,7 @@ procedure TDHStyleLinkProp.SetPropsToCanvas(C: TCanvas);
18941943begin
18951944 if FFontColor<>clNone then DefineFontColor(C, FFontColor);
18961945 if FBackColor<>clNone then DefineFillColor(C, FBackColor);
1897- if FUnderline then C.Font.Style := C.Font.Style + [TFontStyle .fsUnderline];
1946+ if FUnderline then C.Font.Style := C.Font.Style + [TMyFontStyle .fsUnderline];
18981947end ;
18991948
19001949procedure TDHStyleLinkProp.Assign (Source: TPersistent);
0 commit comments