Ver Mensaje Individual
  #11  
Antiguo 08-12-2006
Avatar de AzidRain
[AzidRain] AzidRain is offline
Miembro Premium
 
Registrado: sep 2005
Ubicación: Córdoba, Veracruz, México
Posts: 2.914
Reputación: 21
AzidRain Va camino a la fama
Este código hace un "HotTrack" con Labels y checkboxes, si lo cambian un poco sirve para cualquier control...me parece que se explica solo

Código Delphi [-]
{Hay que sobreescribir el procedimiento WndProc procedure}
procedure WndProc(var Message : TMessage) ; override ;

procedure TForm1.WndProc(var Mesg : TMessage) ;
begin
{Aqui vemos que componente ha cambiado. 
  El bit de aqui nos dice sobre que componente se encuentra el mouse }
     if Mesg.LParam = Longint(Label1) then
        ChangeColor(Label1, Mesg.Msg) ;
     if Mesg.LParam = Longint(Label2) then
        ChangeColor(Label2, Mesg.Msg) ;
     if Mesg.LParam = Longint(Label3) then
        ChangeColor(Label3, Mesg.Msg) ;
     if Mesg.LParam = Longint(CheckBox1) then
        ChangeColor(CheckBox1, Mesg.Msg) ;

   inherited WndProc(Mesg) ;
end;


procedure TForm1.ChangeColor
   (Sender : TObject; Msg : Integer) ;
Begin
{ Si el mouse está sobre un label tenemos que hacer esto} 

  if Sender IS TLabel Then
   begin
     if (Msg = CM_MOUSELEAVE) then
      (Sender As TLabel).Font.Color:=clWindowText;
     if (Msg = CM_MOUSEENTER) then
      (Sender As TLabel).Font.Color:=clBlue;
   end;

{ Si es un checkbox...}  
  if Sender IS TCheckBox Then
   begin
    if (Msg = CM_MOUSELEAVE) then
     (Sender As TCheckBox).Font.Color:=clWindowText ;
    if (Msg = CM_MOUSEENTER) then
     (Sender As TCheckBox).Font.Color:=clRed ;
   end;
end;
__________________
AKA "El animalito" ||Cordobés a mucha honra||
Responder Con Cita