⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 flatsound.pas

📁 comerose_flatstyle_v4.42.9.0_d7.rar
💻 PAS
字号:
unit FlatSound;

interface

{$I FlatStyle.inc}

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  MMSystem, FlatUtils;

type
  TSoundEvent = (seBtnClick, seMenu, seMenuClick, seMoveIntoBtn, sePanelExpand);

type
  TFlatSound = class(TVersionComponent)
  private
    FEvent: TSoundEvent;
  public
    procedure Play;
    procedure PlayThis(ThisEvent: TSoundEvent);
    constructor Create(AOwner: TComponent); override;
  published
    property Event: TSoundEvent read FEvent write FEvent;
  end;

const
  Flags = SND_RESOURCE or SND_SYNC;

implementation

{$R FlatSound.res}

constructor TFlatSound.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  Event := seBtnClick;
end;

procedure TFlatSound.Play;
begin
  case FEvent of
    seBtnClick:    PlaySound('ENC_001',0,Flags);
    seMenu:        PlaySound('ENC_002',0,Flags);
    seMenuClick:   PlaySound('ENC_003',0,Flags);
    seMoveIntoBtn: PlaySound('ENC_004',0,Flags);
    sePanelExpand: PlaySound('ENC_005',0,Flags);
  end;
end;

procedure TFlatSound.PlayThis(ThisEvent: TSoundEvent);
begin
  case ThisEvent of
    seBtnClick:    PlaySound('ENC_001',0,Flags);
    seMenu:        PlaySound('ENC_002',0,Flags);
    seMenuClick:   PlaySound('ENC_003',0,Flags);
    seMoveIntoBtn: PlaySound('ENC_004',0,Flags);
    sePanelExpand: PlaySound('ENC_005',0,Flags);
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -