Ver Mensaje Individual
  #5  
Antiguo 13-01-2008
canelita canelita is offline
Miembro
 
Registrado: ago 2007
Ubicación: Cucuta
Posts: 18
Reputación: 0
canelita Va por buen camino
Componente Shape con Imagen Evento y texto.

unit shape1;
interface
uses
Windows, Messages, graphics, SysUtils, Classes, Controls, ExtCtrls;
type
oNCLICKEVENTO =procedure(Sender:TObject) of object;
tshape1 = class(TShape)
private
FOnClick: oNCLICKEVENTO;
FCaption:string;
Fbitmat:tbitmap;
procedure CMMouseClick(var msg:TMessage);//; message CM_MOUSECLICK;
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
Property Tcaption:string read Fcaption write fcaption ;
property OnClick: oNCLICKEVENTO read FOnClick write FOnClick ;
Property bitmat:Tbitmap read fbitmat write fbitmat;
procedure LLenaimagen(x:String);

{ Published declarations }
end;
procedure Register;
implementation
unit shape1;
interface
uses
Windows, Messages, graphics, SysUtils, Classes, Controls, ExtCtrls;
type
oNCLICKEVENTO =procedure(Sender:TObject) of object;
tshape1 = class(TShape)
private
FOnClick: oNCLICKEVENTO;
FCaption:string;
Fbitmat:tbitmap;
procedure CMMouseClick(var msg:TMessage);//; message CM_MOUSECLICK;
{ Private declarations }
protected
{ Protected declarations }
public
{ Public declarations }
published
Property Tcaption:string read Fcaption write fcaption ;
property OnClick: oNCLICKEVENTO read FOnClick write FOnClick ;
Property bitmat:Tbitmap read fbitmat write fbitmat;
procedure LLenaimagen(x:String);

{ Published declarations }
end;
procedure Register;
implementation


procedure TShape1.CMMouseClick(var Msg:TMessage);
begin
inherited;
if Assigned (FOnClick) then
FOnClick(Self);
end;
procedure TShape1.LLenaimagen(x:string);
var Bitmap: TBitmap;
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile(x);
Canvas.Brush.Bitmap := Bitmap;
Canvas.FillRect(Rect(0,0,100,200));
finally
Canvas.Brush.Bitmap := nil;
Bitmap.Free;
end;
end;

procedure Register;
begin
RegisterComponents('Additional', [tshape1]);
end;

end.
Responder Con Cita