본문 바로가기
Application/Delphi Lecture

Mouse Wheel 처리

by 현이빈이 2008. 7. 24.
반응형

1) public 부분에 아래의 함수를 선언합니다.
procedure OnWMMouse(var Msg : TWMSysCommand); message WM_MOUSEWHEEL;

2) 다음과 같이 코딩합니다.
  - 휠마우스를 위로 굴리시면 Msg.CmdType 가 음수(-)값이 나오고
  -            아래로 굴리시면 Msg.CmdType 가 양수(+)값이 나옵니다.  

procedure TFormHistory.OnWMMouse(var Msg: TWMSysCommand);
begin
 if Not (ActiveControl is TRealGrid) then Exit;

 if (Msg.CmdType < 0 ) then RGridCallList.Row := RGridCallList.Row + 1
 else                       RGridCallList.Row := RGridCallList.Row - 1;

 inherited;
end;

반응형