ExCtrls: Fix transparent text background, Fix selected item not shown.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@7940 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2020-12-21 21:32:47 +00:00
parent 5a8a5a318d
commit 577782d54e

View File

@ -55,6 +55,7 @@ type
procedure SetOffsets; procedure SetOffsets;
procedure SetShowColSeparators(aValue: Boolean); procedure SetShowColSeparators(aValue: Boolean);
protected protected
procedure CreateHandle; override;
procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy; procedure DoAutoAdjustLayout(const AMode: TLayoutAdjustmentPolicy;
const AXProportion, AYProportion: Double); override; const AXProportion, AYProportion: Double); override;
class function GetControlClassDefaultSize: TSize; override; class function GetControlClassDefaultSize: TSize; override;
@ -178,6 +179,12 @@ begin
Result := FColumnMargin <> Scale96ToFont(DEFAULT_COLUMN_MARGIN); Result := FColumnMargin <> Scale96ToFont(DEFAULT_COLUMN_MARGIN);
end; end;
procedure TColumnComboBoxEx.CreateHandle;
begin
inherited;
SetOffsets;
end;
procedure TColumnComboBoxEx.DoAutoAdjustLayout( procedure TColumnComboBoxEx.DoAutoAdjustLayout(
const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double const AMode: TLayoutAdjustmentPolicy; const AXProportion, AYProportion: Double
); );
@ -212,14 +219,19 @@ begin
FParser.Delimiter := FDelimiter; FParser.Delimiter := FDelimiter;
FParser.DelimitedText := txt; FParser.DelimitedText := txt;
if (odSelected in State) then if not(odBackgroundPainted in State) then
Canvas.FillRect(ARect);
{ if (odSelected in State) then
Canvas.Brush.Color := clHighlight Canvas.Brush.Color := clHighlight
else if (Canvas.Brush.Color <> Color) then else if (Canvas.Brush.Color <> Color) then
Canvas.Brush.Color := Color; Canvas.Brush.Color := Color;
Canvas.FillRect(ARect); Canvas.FillRect(ARect);}
y := ARect.Top + (ARect.Height - FTextHeight) shr 1; y := ARect.Top + (ARect.Height - FTextHeight) shr 1;
Canvas.Brush.Style := bsClear; // transparent text background
if Assigned(FOffsets) then if Assigned(FOffsets) then
begin begin
for i := 0 to FParser.Count-1 do for i := 0 to FParser.Count-1 do
@ -375,6 +387,7 @@ var
begin begin
if not Assigned(Parent) or (Items.Count = 0) then if not Assigned(Parent) or (Items.Count = 0) then
Exit; Exit;
FColumnCount := GetColumnCount; FColumnCount := GetColumnCount;
SetLength({%H-}widths, FColumnCount); SetLength({%H-}widths, FColumnCount);