win32: paint menu text with a transparent text background (by cobines, issue #0018424)

git-svn-id: trunk@35911 -
This commit is contained in:
paul 2012-03-13 00:58:52 +00:00
parent 7763dcfc36
commit a452a818da

View File

@ -966,6 +966,7 @@ procedure DrawMenuItemText(const AMenuItem: TMenuItem; const AHDC: HDC;
var var
crText: COLORREF; crText: COLORREF;
crBkgnd: COLORREF; crBkgnd: COLORREF;
oldBkMode: Longint;
shortCutText: string; shortCutText: string;
IsRightToLeft: Boolean; IsRightToLeft: Boolean;
etoFlags: Cardinal; etoFlags: Cardinal;
@ -1027,6 +1028,8 @@ begin
Dec(ARect.Top, 1); Dec(ARect.Top, 1);
Dec(ARect.Bottom, 1); Dec(ARect.Bottom, 1);
oldBkMode := SetBkMode(AHDC, TRANSPARENT);
{$ifdef WindowsUnicodeSupport} {$ifdef WindowsUnicodeSupport}
if UnicodeEnabledOS then if UnicodeEnabledOS then
begin begin
@ -1066,6 +1069,8 @@ begin
DrawText(AHDC, PChar(shortCutText), Length(shortCutText), @ARect, dtFlags); DrawText(AHDC, PChar(shortCutText), Length(shortCutText), @ARect, dtFlags);
{$endif} {$endif}
end; end;
SetBkMode(AHDC, oldBkMode);
end; end;
procedure DrawMenuItemIcon(const AMenuItem: TMenuItem; const AHDC: HDC; procedure DrawMenuItemIcon(const AMenuItem: TMenuItem; const AHDC: HDC;