designer: improve look of non-visual components

git-svn-id: trunk@18805 -
This commit is contained in:
paul 2009-02-23 08:34:04 +00:00
parent dfc003e02b
commit 1fdf7aac12
2 changed files with 10 additions and 24 deletions

View File

@ -2466,7 +2466,7 @@ end;
procedure TDesigner.DrawNonVisualComponents(aDDC: TDesignerDeviceContext); procedure TDesigner.DrawNonVisualComponents(aDDC: TDesignerDeviceContext);
var var
i, j, ItemLeft, ItemTop, ItemRight, ItemBottom: integer; i, ItemLeft, ItemTop, ItemRight, ItemBottom: integer;
Diff, ItemLeftTop: TPoint; Diff, ItemLeftTop: TPoint;
IconRect: TRect; IconRect: TRect;
Icon: TBitmap; Icon: TBitmap;
@ -2482,36 +2482,22 @@ begin
// non-visual component // non-visual component
ItemLeftTop := NonVisualComponentLeftTop(AComponent); ItemLeftTop := NonVisualComponentLeftTop(AComponent);
ItemLeft := ItemLeftTop.X - Diff.X; ItemLeft := ItemLeftTop.X - Diff.X;
ItemTop := ItemLeftTop.Y-Diff.Y; ItemTop := ItemLeftTop.Y - Diff.Y;
ItemRight := ItemLeft+NonVisualCompWidth; ItemRight := ItemLeft + NonVisualCompWidth;
ItemBottom := ItemTop+NonVisualCompWidth; ItemBottom := ItemTop + NonVisualCompWidth;
if not aDDC.RectVisible(ItemLeft, ItemTop, ItemRight, ItemBottom) then if not aDDC.RectVisible(ItemLeft, ItemTop, ItemRight, ItemBottom) then
Continue; Continue;
aDDC.Save; aDDC.Save;
with aDDC.Canvas do with aDDC.Canvas do
begin begin
Pen.Width := 1; Pen.Width := 1;
Pen.Color := clWhite; IconRect := Rect(ItemLeft, ItemTop, ItemRight, ItemBottom);
for j := 0 to NonVisualCompBorder - 1 do Frame3D(IconRect, 1, bvRaised);
begin
MoveTo(ItemLeft + j, ItemBottom - j);
LineTo(ItemLeft + j, ItemTop + j);
LineTo(ItemRight - j, ItemTop + j);
end;
Pen.Color := clBlack;
for j := 0 to NonVisualCompBorder - 1 do
begin
MoveTo(ItemLeft + j, ItemBottom - j);
LineTo(ItemRight - j, ItemBottom - j);
MoveTo(ItemRight - j, ItemTop + j);
LineTo(ItemRight - j, ItemBottom - j + 1);
end;
IconRect := Rect(ItemLeft + NonVisualCompBorder, ItemTop + NonVisualCompBorder,
ItemRight - NonVisualCompBorder, ItemBottom - NonVisualCompBorder);
Brush.Color := clBtnFace; Brush.Color := clBtnFace;
//writeln('TDesigner.DrawNonVisualComponents A ',IconRect.Left,',',IconRect.Top,',',IconRect.Right,',',IconRect.Bottom);
FillRect(Rect(IconRect.Left, IconRect.Top, FillRect(Rect(IconRect.Left, IconRect.Top,
IconRect.Right + 1, IconRect.Bottom + 1)); IconRect.Right, IconRect.Bottom));
if NonVisualCompBorder > 1 then
InflateRect(IconRect, -NonVisualCompBorder + 1, - NonVisualCompBorder + 1);
end; end;
if Assigned(FOnGetNonVisualCompIcon) then if Assigned(FOnGetNonVisualCompIcon) then
begin begin

View File

@ -82,7 +82,7 @@ type
const const
NonVisualCompIconWidth = ComponentPaletteImageWidth; NonVisualCompIconWidth = ComponentPaletteImageWidth;
NonVisualCompBorder = 2; NonVisualCompBorder = 2;
NonVisualCompWidth = NonVisualCompIconWidth+2*NonVisualCompBorder; NonVisualCompWidth = NonVisualCompIconWidth + 2 * NonVisualCompBorder;
type type