有。我作的activex控件就有这个事件
是speedbutton的事件
这是代码
procedure TAFXMainForm.SBtnInputMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
TempSBtn: TSpeedButton;
begin
TempSBtn := (Sender As TSpeedButton);
If ((X > 5) Or (Y > 5)) And
((X < TempSBtn.Width - 5) Or (Y < TempSBtn.Height - 5)) Then
Begin
If TempSBtn.Font.Color = clBlack Then
Begin
TempSBtn.Font.Color := clBlue;
TempSBtn.Font.Style := TempSBtn.Font.Style + [fsBold, fsUnderline];
TempSBtn.Font.Size := TempSBtn.Font.Size + 1;
End;
End
Else
Begin
If TempSBtn.Font.Color = clBlue Then
Begin
TempSBtn.Font.Color := clBlack;
TempSBtn.Font.Style := TempSBtn.Font.Style - [fsBold, fsUnderline];
TempSBtn.Font.Size := TempSBtn.Font.Size - 1;
End;
End;
end;
是speedbutton的事件
这是代码
procedure TAFXMainForm.SBtnInputMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
TempSBtn: TSpeedButton;
begin
TempSBtn := (Sender As TSpeedButton);
If ((X > 5) Or (Y > 5)) And
((X < TempSBtn.Width - 5) Or (Y < TempSBtn.Height - 5)) Then
Begin
If TempSBtn.Font.Color = clBlack Then
Begin
TempSBtn.Font.Color := clBlue;
TempSBtn.Font.Style := TempSBtn.Font.Style + [fsBold, fsUnderline];
TempSBtn.Font.Size := TempSBtn.Font.Size + 1;
End;
End
Else
Begin
If TempSBtn.Font.Color = clBlue Then
Begin
TempSBtn.Font.Color := clBlack;
TempSBtn.Font.Style := TempSBtn.Font.Style - [fsBold, fsUnderline];
TempSBtn.Font.Size := TempSBtn.Font.Size - 1;
End;
End;
end;
具体做法是这样:
在类型库中IXXXEvents 接口中添加一个方法,比如OnMouseMove
刷新让它产生实现代码.映射一个WM_MOUSEMOVE消息函数,
在消息函数中加入
if Assigned(FEvents) then
FEvents.OnMouseMove;