LCL: Improved painting of the clNone color icon in TColorBox. Issue #26707, patch from wp.

git-svn-id: trunk@46191 -
This commit is contained in:
juha 2014-09-11 18:03:30 +00:00
parent 9102f248ea
commit 94f04cc3f2

View File

@ -545,6 +545,7 @@ procedure TCustomColorBox.DrawItem(Index: Integer; Rect: TRect; State: TOwnerDra
var
r: TRect;
BrushColor, PenColor, NewColor: TColor;
noFill: Boolean;
begin
if Index = -1 then
Exit;
@ -555,6 +556,8 @@ begin
r.right := r.left + FColorRectWidth;
Exclude(State, odPainted);
noFill := false;
with Canvas do
begin
FillRect(Rect);
@ -565,7 +568,10 @@ begin
NewColor := Self.Colors[Index];
if NewColor = clNone then
NewColor := NoneColorColor
begin
NewColor := NoneColorColor;
noFill := true;
end
else
if NewColor = clDefault then
NewColor := DefaultColorColor;
@ -573,7 +579,14 @@ begin
Brush.Color := NewColor;
Pen.Color := clBlack;
Rectangle(BidiFlipRect(r, Rect, UseRightToLeftAlignment));
r := BiDiFlipRect(r, Rect, UseRightToLeftAlignment);
Rectangle(r);
if noFill then
begin
Line(r.Left, r.Top, r.Right-1, r.Bottom-1);
Line(r.Left, r.Bottom-1, r.Right-1, r.Top);
end;
Brush.Color := BrushColor;
Pen.Color := PenColor;