Ver Mensaje Individual
  #3  
Antiguo 12-09-2007
Avatar de José Luis Garcí
[José Luis Garcí] José Luis Garcí is offline
Miembro Premium
 
Registrado: may 2003
Ubicación: Las Palmas de G.C.
Posts: 1.372
Reputación: 25
José Luis Garcí Va camino a la fama
Gracias por la informacion Maeyanes, lo he intentado, pero sigo sin saber por que falla, es mas ahorame da un error de Access Violation al probar la demo, pongo el código completo del componente, para saber si me echan una mano.

Código Delphi [-]
unit UCCDShadow;

interface

uses
  Windows, Messages, SysUtils, Controls, ComCtrls,Classes, Forms, QGraphics, Graphics;

type
  TCCDShadow = class(TComponent)
  private
    { Private declarations }
  FDeph : Integer;
  FColor: Tcolor;
  ParentForm: TForm;
  protected
  { Protected declarations }
    procedure ShadowDraw;
    procedure Setdeph(value : Integer);
    procedure Setcolor(Value: TColor);
    //procedure Loaded; virtual;
    procedure Notification(AComponent: TComponent; Operation: TOperation); override;
     
  public
    { Public declarations }
    constructor Create(aOwner: TComponent); override;
    destructor Destroy(); override;
  published
    { Published declarations }
    property Deph: Integer read FDeph write SetDeph default 3;
    property Color: Tcolor read FColor write SetColor default clAqua;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('CLub Delphi', [TCCDShadow]);
end;
constructor TCCDShadow.Create(aOwner: TComponent);
begin
    inherited Create(aOwner);
    ParentForm:=TForm(AOwner);
    Fcolor:=clAqua;
    Fdeph:=3;
    ShadowDraw;
end;

destructor TCCDShadow.Destroy();
begin
   inherited Destroy();
end;

Procedure TCCDShadow.SetColor(value : TColor);
begin
  if (FColor <> value) then FColor:= value;
  ShadowDraw;
end;

procedure TCCDShadow.SetDeph(value : Integer);
begin
  if (Fdeph <> value) then FDeph:= value;
  ShadowDraw;
end;

procedure TCCDShadow.ShadowDraw;
var
I: Integer;
rect: TRect;
old: TColor;
Component : TComponent;
begin
      ParentForm.Repaint;
      for I:= 0 to ParentForm.ControlCount -1 do
      begin
        with ParentForm do
        begin
          Component:=Components[i];
          if Component is TControl then
          begin
             rect := Controls[i].BoundsRect;
             canvas.fillrect(rect);
             rect.Left := rect.Left + FDeph;
             rect.Top := rect.Top + FDeph;
             rect.Right := rect.Right + FDeph;
         rect.Bottom := rect.Bottom + FDeph;
             old := Canvas.brush.color;
             canvas.brush.Color :=  Fcolor;
             canvas.fillrect(rect);

             canvas.brush.Color := old;
             Controls[i].Repaint
          end;
        end;
      end;
end;
procedure TCCDShadow.Notification(AComponent: TComponent; Operation: TOperation);
begin
  inherited Notification(AComponent,Operation);
  if (Operation = opinsert) and (AComponent is TCCDShadow) then  ShadowDraw;
  TCCDShadow(AComponent).ShadowDraw;
 end;

end.
__________________
Un saludo desde Canarias, "El abuelo Cebolleta"
Responder Con Cita