📄 ledreg.pas
字号:
unit LedReg;
Interface
uses
Classes,
LedBtn,
{$IFDEF VER130}
DsgnIntf,
{$ELSE}
DesignIntf,
DesignEditors,
{$ENDIF}
Forms,
Dialogs;
type
TSoundFileProperty = class(TStringProperty)
public
procedure Edit; override;
function GetAttributes: TPropertyAttributes; override;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Additional', [TLedButton]);
RegisterPropertyEditor(TypeInfo(String), TLedButton, 'SoundFile', TSoundFileProperty);
end;
procedure TSoundFileProperty.Edit;
var
MPFileOpen: TOpenDialog;
begin
MPFileOpen := TOpenDialog.Create(Application);
MPFileOpen.Filename := GetValue;
MPFileOpen.Filter := 'Sound File (*.wav)|*.wav';
MPFileOpen.Options := MPFileOpen.Options + [ofPathMustExist,
ofFileMustExist];
try
if MPFileOpen.Execute then SetValue(MPFileOpen.Filename);
finally
MPFileOpen.Free;
end;
end;
function TSoundFileProperty.GetAttributes: TPropertyAttributes;
begin
Result := [paDialog];
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -