Delphiturbo
Messages postés68Date d'inscriptionmercredi 31 octobre 2007StatutMembreDernière intervention29 juillet 2008
-
25 mai 2008 à 14:21
Delphiturbo
Messages postés68Date d'inscriptionmercredi 31 octobre 2007StatutMembreDernière intervention29 juillet 2008
-
26 mai 2008 à 10:52
Salut
j ai Delphi7 mais cette Version n' a pas Events : OnMouseEnter and OnMouseLeave
Je voudrais faire cet Efecte :
Demo
also je dois faire un Code
J ai essaiee avec cette Code mais il ne pas marche corectement !
florenth
Messages postés1023Date d'inscriptiondimanche 1 août 2004StatutMembreDernière intervention17 août 20083 25 mai 2008 à 16:45
Salut !
t'es sur que tu t'es pas emmêlé les pinceaux avec ton indentation ?
N'est-ce pas ceci que tu voulais faire : ?
procedure TForm1.CMMouseEnter(var Message: TMessage);
var
ptWork : TPoint;
begin
GetCursorPos(ptWork);
if WindowFromPoint(ptWork) = BitBtn1.Handle then
begin
BitBtn1.Glyph := nil;
ImageList1.GetBitmap(0, BitBtn1.Glyph);
end;
end;
procedure TForm1.CMMouseLeave(var Message: TMessage);
var
ptWork : TPoint;
begin
GetCursorPos(ptWork);
if WindowFromPoint(ptWork) = BitBtn1.Handle then
begin
BitBtn1.Glyph := nil;
ImageList1.GetBitmap(1, BitBtn1.Glyph);
end;
end;
{ code de fonctionnement interne de l'overclassing des composants devant avoir les evenements MouseEnter et MouseLeave.
Message CMMouseEnter/CMMouseLeave -> declanche l'evenement correspondant OnMouseEnter/OnMouseLeave }
{ TButton }
procedure TButton.CMMouseEnter(var Message: TMessage);
begin
if Assigned(fOnMouseEnter) then
fOnMouseEnter(Self);
end;
procedure TButton.CMMouseLeave(var Message: TMessage);
begin
if Assigned(fOnMouseLeave) then
fOnMouseLeave(Self);
end;
{ TEdit }
procedure TEdit.CMMouseEnter(var Message: TMessage);
begin
if Assigned(fOnMouseEnter) then
fOnMouseEnter(Self);
end;
procedure TEdit.CMMouseLeave(var Message: TMessage);
begin
if Assigned(fOnMouseLeave) then
fOnMouseLeave(Self);
end;
{ TBitBtn }
procedure TBitBtn.CMMouseEnter(var Message: TMessage);
begin
if Assigned(fOnMouseEnter) then
fOnMouseEnter(Self);
end;
procedure TBitBtn.CMMouseLeave(var Message: TMessage);
begin
if Assigned(fOnMouseLeave) then
fOnMouseLeave(Self);
end;
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.CMMouseEnter(var Message: TMessage);
var
ptWork : TPoint;
begin
GetCursorPos(ptWork);
if WindowFromPoint(ptWork) = BitBtn1.Handle then
begin
BitBtn1.Glyph := nil;
ImageList1.GetBitmap(0, BitBtn1.Glyph);
end;
end;
procedure TForm1.CMMouseLeave(var Message: TMessage);
var
ptWork : TPoint;
begin
GetCursorPos(ptWork);
if WindowFromPoint(ptWork) <> BitBtn1.Handle then
begin
BitBtn1.Glyph := nil;
ImageList1.GetBitmap(1, BitBtn1.Glyph);
end;
end;
end.
Vous n’avez pas trouvé la réponse que vous recherchez ?