Index: Forms.pas =================================================================== --- Forms.pas (revision 59427) +++ Forms.pas (working copy) @@ -8053,6 +8053,25 @@ LogFont: TLogFont; NonClientMetrics: TNonClientMetrics; SaveShowHint: Boolean; + + procedure SafeChangeFont(aFontToChange: TFont; aLogFont: tagLOGFONTW); + var + LTmpFont: TFont; + begin + LTmpFont := TFont.Create; + try + LTmpFont.Assign(aFontToChange); + LTmpFont.Handle := CreateFontIndirect(aLogFont); + if (LTmpFont.Size <> aFontToChange.Size) + or (LTmpFont.Name <> aFontToChange.Name) + or (LTmpFont.Style <> aFontToChange.Style) then + begin + aFontToChange.Handle := CreateFontIndirect(aLogFont); + end; + finally + FreeAndNil(LTmpFont); + end; + end; begin SaveShowHint := False; if Assigned(Application) then SaveShowHint := Application.ShowHint; @@ -8064,7 +8083,9 @@ LSize := SizeOf(TLogFont); {$IFEND} if SystemParametersInfo(SPI_GETICONTITLELOGFONT, LSize, {$IFNDEF CLR}@{$ENDIF}LogFont, 0) then - FIconFont.Handle := CreateFontIndirect(LogFont) + begin + SafeChangeFont(FIconFont, LogFont); + end else FIconFont.Handle := GetStockObject(SYSTEM_FONT); {$IF DEFINED(CLR)} @@ -8075,10 +8096,10 @@ NonClientMetrics.cbSize := LSize; if SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, {$IFNDEF CLR}@{$ENDIF}NonClientMetrics, 0) then begin - FHintFont.Handle := CreateFontIndirect(NonClientMetrics.lfStatusFont); - FMenuFont.Handle := CreateFontIndirect(NonClientMetrics.lfMenuFont); - FMessageFont.Handle := CreateFontIndirect(NonClientMetrics.lfMessageFont); - FCaptionFont.Handle := CreateFontIndirect(NonClientMetrics.lfCaptionFont); + SafeChangeFont(FHintFont, NonClientMetrics.lfStatusFont); + SafeChangeFont(FMenuFont, NonClientMetrics.lfMenuFont); + SafeChangeFont(FMessageFont, NonClientMetrics.lfMessageFont); + SafeChangeFont(FCaptionFont, NonClientMetrics.lfCaptionFont); end else begin FHintFont.Size := 8;