Ver Mensaje Individual
  #5  
Antiguo 19-02-2013
rotsen26 rotsen26 is offline
Miembro
NULL
 
Registrado: ene 2013
Posts: 41
Reputación: 0
rotsen26 Va por buen camino
Cita:
Empezado por ecfisa Ver Mensaje
Hola de nuevo.

Se me ocurrió otra forma de realizar lo mismo y que evita las múltiples asignaciones al evento OnClick de los TPanel:
Código Delphi [-]
...
implementation

var
  PrevWinCtrl: TWinControl;

procedure TForm1.MouseEvent(var Msg: TMsg; var Handled: Boolean);
var
  Ctrl : TWinControl;
begin
  if Msg.message =  WM_LBUTTONDOWN then
  begin
    Ctrl := FindVCLWindow(Mouse.CursorPos);
    if Assigned(Ctrl) and (Ctrl is TPanel) then
    begin
      if Assigned(PrevWinCtrl) then
        TPanel(PrevWinCtrl).Color := clBtnFace; 
      TPanel(Ctrl).Color := clRed;
      PrevWinCtrl := TWinControl(Ctrl);
    end;
  end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
   Application.OnMessage := MouseEvent;
end;
...

Saludos.


Una pregunta, el siguiente código a que se refiere???
Código Delphi [-]
if Msg.message =  WM_LBUTTONDOWN then

Porque me marca error en el!!!
Responder Con Cita