根据一个视频教学做了个倒计时控件,其他功能都正常 就是BeginTime这个属性的属性编辑器 点击就出现图片错误
代码和视频中的代码对过都一样的

控件注册代码
unit Reg;
interface
uses Classes,Oclock,DesignIntf,ClockPe,ClockEdit;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('kj21', [TClock ]);
RegisterPropertyInCategory('shuxing',TClock,'State') ;
RegisterPropertyEditor(TypeInfo(TBeginTime),TClock,'BeginTime',TClockProperty);
RegisterComponentEditor(TClock,TClockEditor);
end;
end.
属性编辑器调出代码
unit ClockPe;
interface
uses
Classes,DesignIntf,Forms,DesignEditors,TimeEditFrm,SysUtils,Controls;
type
TClockProperty=class(TStringProperty)
function GetAttributes:TPropertyAttributes;override;
procedure Edit;override;
end;
implementation
{ TClockProperty }
procedure TClockProperty.Edit;
var
TimeEditForm:TTimeEdit_Form;
begin
TimeEditForm:=TimeEdit_Form.Create(Application);
// TimeEditForm:=TimeEdit_Form.Create(Owner);
try
TimeEditForm.DateTimePicker1.Time:=StrToTime(GetValue);
//GetValue方法属于TClockProperty的父类,它的作用是取得BeginTime属性的当前值
if TimeEditForm.ShowModal=mrOK then
begin
SetValue(TimeToStr(TimeEditForm.DateTimePicker1.Time));
end;
finally
TimeEditForm.Free;
end;
end;
function TClockProperty.GetAttributes: TPropertyAttributes;
begin
Result:=[paDialog,paMultiSelect];
end;
end.
代码和视频中的代码对过都一样的

控件注册代码
unit Reg;
interface
uses Classes,Oclock,DesignIntf,ClockPe,ClockEdit;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('kj21', [TClock ]);
RegisterPropertyInCategory('shuxing',TClock,'State') ;
RegisterPropertyEditor(TypeInfo(TBeginTime),TClock,'BeginTime',TClockProperty);
RegisterComponentEditor(TClock,TClockEditor);
end;
end.
属性编辑器调出代码
unit ClockPe;
interface
uses
Classes,DesignIntf,Forms,DesignEditors,TimeEditFrm,SysUtils,Controls;
type
TClockProperty=class(TStringProperty)
function GetAttributes:TPropertyAttributes;override;
procedure Edit;override;
end;
implementation
{ TClockProperty }
procedure TClockProperty.Edit;
var
TimeEditForm:TTimeEdit_Form;
begin
TimeEditForm:=TimeEdit_Form.Create(Application);
// TimeEditForm:=TimeEdit_Form.Create(Owner);
try
TimeEditForm.DateTimePicker1.Time:=StrToTime(GetValue);
//GetValue方法属于TClockProperty的父类,它的作用是取得BeginTime属性的当前值
if TimeEditForm.ShowModal=mrOK then
begin
SetValue(TimeToStr(TimeEditForm.DateTimePicker1.Time));
end;
finally
TimeEditForm.Free;
end;
end;
function TClockProperty.GetAttributes: TPropertyAttributes;
begin
Result:=[paDialog,paMultiSelect];
end;
end.