LCL/TPanel: New property ShowAccelChar to improve Delphi compatibility in rendering of ampersands. Issue #39973.

This commit is contained in:
wp_xyz 2022-10-28 00:09:56 +02:00
parent fbe7aa44e1
commit eff48575cf
2 changed files with 14 additions and 0 deletions

View File

@ -1084,6 +1084,7 @@ type
FAlignment : TAlignment;
FVertAlignment: TVerticalAlignment;
FFullRepaint: Boolean;
FShowAccelChar: Boolean;
FWordWrap: Boolean;
procedure PaintBevel(var ARect: TRect; ABevel: TPanelBevel);
procedure SetAlignment(const Value : TAlignment);
@ -1091,6 +1092,7 @@ type
procedure SetBevelInner(const Value: TPanelBevel);
procedure SetBevelOuter(const Value: TPanelBevel);
procedure SetBevelWidth(const Value: TBevelWidth);
procedure SetShowAccelChar(const Value: Boolean);
procedure SetVertAlignment(const Value: TVerticalAlignment);
procedure SetWordwrap(const Value: Boolean);
protected
@ -1104,6 +1106,7 @@ type
procedure Paint; override;
procedure SetParentBackground(const AParentBackground: Boolean); override;
procedure UpdateParentColorChange;
property ShowAccelChar: Boolean read FShowAccelChar write SetShowAccelChar default false;
property VerticalAlignment: TVerticalAlignment read FVertAlignment write SetVertAlignment default taVerticalCenter;
property WordWrap: Boolean read FWordwrap write SetWordwrap default false;
public
@ -1159,6 +1162,7 @@ type
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowAccelChar;
property ShowHint;
property TabOrder;
property TabStop;

View File

@ -84,6 +84,15 @@ begin
inherited;
end;
procedure TCustomPanel.SetShowAccelChar(const Value: Boolean);
begin
if FShowAccelChar <> Value then
begin
FShowAccelChar := Value;
Invalidate;
end;
end;
procedure TCustomPanel.SetVertAlignment(const Value: TVerticalAlignment);
begin
if FVertAlignment <> Value then
@ -161,6 +170,7 @@ begin
TS.SystemFont:=Canvas.Font.IsDefault;
TS.Wordbreak := FWordWrap;
TS.SingleLine := not FWordwrap;
TS.ShowPrefix := FShowAccelChar;
if not Enabled then
if ThemeServices.ThemesEnabled then
Canvas.Font.Color := clGrayText