我想写一个panel后面有阴影的控件像速达入库单上那个Panel一样在右边和下边有阴影,我写了一下但没有效不知何故,贴出源码
unit panelcolor;interfaceuses
  SysUtils, Classes, Controls, ExtCtrls,Forms,Graphics,Windows,Messages,Dialogs;type
  tpanelcolor = class(tpanel)
  private
    FShadeNumer: integer;
    FShadeColor: TColor;
    procedure SetShadeNumer(const Value: integer);
    procedure SetShadeColor(const Value: TColor);
    { Private declarations }
  protected
    { Protected declarations }
  public
    { Public declarations }
    f1:TForm;
    constructor Create();
    destructor Destroy; override;
    procedure ShadeId(c: TControl; Width: Integer; Color: TColor);
  published
    { Published declarations }
    property ShadeColor:TColor read FShadeColor write SetShadeColor;
    property ShadeNumer:integer read FShadeNumer write SetShadeNumer default 1;
  end;procedure Register;implementationprocedure Register;
begin
  RegisterComponents('Standard', [tpanelcolor]);
end;constructor tpanelcolor.Create;
begin
end;destructor tpanelcolor.Destroy;
begin
  inherited;
end;procedure tpanelcolor.SetShadeColor(const Value: TColor);
begin
  FShadeColor := Value;
  ShadeId(self,ShadeNumer,ShadeColor);
end;procedure tpanelcolor.SetShadeNumer(const Value: integer);
begin
  FShadeNumer := Value;
  if value>0 then
    ShadeId(self,ShadeNumer,ShadeColor);
end;procedure tpanelcolor.ShadeId( c: TControl; Width: Integer; Color: TColor);
var
rect: TRect;
old: TColor;
begin
if (c.Visible) then
begin
rect := c.BoundsRect;
rect.Left := rect.Left + Width;
rect.Top := rect.Top + Width;
rect.Right := rect.Right + Width;
rect.Bottom := rect.Bottom + Width;
canvas.Brush.Color :=color;
canvas.FillRect(rect);
end;
end;end.
.