MdSounB.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit MdSounB;
- interface
- uses
- Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- StdCtrls;
- type
- TMdSoundButton = class(TButton)
- private
- FSoundUp, FSoundDown: string;
- protected
- procedure MouseDown(Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer); override;
- procedure MouseUp(Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer); override;
- published
- property SoundUp: string
- read FSoundUp write FSoundUp;
- property SoundDown: string
- read FSoundDown write FSoundDown;
- end;
- procedure Register;
- implementation
- uses MMSystem;
- procedure TMdSoundButton.MouseDown(Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- begin
- inherited MouseDown (Button, Shift, X, Y);
- PlaySound (PChar (FSoundDown), 0, snd_Async);
- end;
- procedure TMdSoundButton.MouseUp(Button: TMouseButton;
- Shift: TShiftState; X, Y: Integer);
- begin
- inherited MouseUp (Button, Shift, X, Y);
- PlaySound (PChar (FSoundUp), 0, snd_Async);
- end;
- procedure Register;
- begin
- RegisterComponents('Md', [TMdSoundButton]);
- end;
- end.