通過元件的組件編輯器設置的元件屬性為何沒有寫入CFM文件 |
尚未結案
|
Leway
一般會員 發表:43 回覆:71 積分:22 註冊:2003-07-29 發送簡訊給我 |
type
PColorS7 = ^TColorS7REC;
TColorS7REC = record
Light : WORD;
Dark : WORD;
Line : WORD;
Fill : WORD;
Font : WORD;
end; type
TTMStaticS7 = class(TStaticText)
private
f_Length: WORD;
f_ColorS7: TColorS7REC;
published
property Length: WORD read f_Length write f_Length;
property ColorS7: TColorS7REC read f_ColorS7 write f_ColorS7; //在組件編輯器中設置該屬性
end;
procedure TColorDesignEditor.ExecuteVerb(Index: Integer);
begin
inherited;
case Index of
0: begin
f_DesignForm:= TColorDesignForm.Create(application);
try
f_DesignForm.edtLight.Text:= inttostr((Component as TTMStaticS7).ColorS7.Light);
f_DesignForm.edtDark.Text:= inttostr((Component as TTMStaticS7).ColorS7.Dark);
f_DesignForm.edtLine.Text:= inttostr((Component as TTMStaticS7).ColorS7.Line);
f_DesignForm.edtFill.Text:= inttostr((Component as TTMStaticS7).ColorS7.Fill);
f_DesignForm.edtFont.Text:= inttostr((Component as TTMStaticS7).ColorS7.Font);
if f_DesignForm.showModal = mrOK then
begin
if Component is TTMStaticS7 then
begin
(Component as TTMStaticS7).f_ColorS7.Light:= strtoInt(f_DesignForm.edtLight.Text);
(Component as TTMStaticS7).f_ColorS7.Dark:= strtoInt(f_DesignForm.edtDark.Text);
(Component as TTMStaticS7).f_ColorS7.Line:= strtoInt(f_DesignForm.edtLine.Text);
(Component as TTMStaticS7).f_ColorS7.Fill:= strtoInt(f_DesignForm.edtFill.Text);
(Component as TTMStaticS7).f_ColorS7.Font:= strtoInt(f_DesignForm.edtFont.Text);
end;
{if Component is then
begin
end;}
end;
finally
f_DesignForm.Free;
end;
end;
end;{case}
end; 發表人 - Leway 於 2003/12/16 20:41:17
|
Leway
一般會員 發表:43 回覆:71 積分:22 註冊:2003-07-29 發送簡訊給我 |
|
mustapha.wang
資深會員 發表:89 回覆:409 積分:274 註冊:2002-03-13 發送簡訊給我 |
Record数据类型在Object Inspetor里是显示不出来的(你没发现吗?);能存入DFM的类别是TPersistent
type TColorS7REC = class(TPersistent) private FLight : WORD; FDark : WORD; FLine : WORD; FFill : WORD; FFont : WORD; protected procedure AssignTo(Dest: TPersistent); override; published property Light : WORD read FLight write FLight; property Dark : WORD read FDark write FDark; property Line : WORD read FLine write FLine; property Font : WORD read FFont write FFont; end; TTMStaticS7 = class(TStaticText) private f_Length: WORD; f_ColorS7: TColorS7REC; procedure SetColorS7(const Value: TColorS7REC); public constructor Create(AOwner:TComponent);override; destructor Destroy;override; published property Length: WORD read f_Length write f_Length; property ColorS7: TColorS7REC read f_ColorS7 write SetColorS7; end; procedure Register; implementation procedure Register; begin RegisterComponents('wer',[TTMStaticS7]); end; { TTMStaticS7 } constructor TTMStaticS7.Create(AOwner: TComponent); begin inherited; f_ColorS7:=TColorS7REC.Create; end; destructor TTMStaticS7.Destroy; begin f_ColorS7.Free; inherited; end; procedure TTMStaticS7.SetColorS7(const Value: TColorS7REC); begin f_ColorS7.Assign(Value); end; { TColorS7REC } procedure TColorS7REC.AssignTo(Dest: TPersistent); begin TColorS7REC(Dest).Light:=FLight; TColorS7REC(Dest).Dark:=FDark; TColorS7REC(Dest).Line:=FLine; TColorS7REC(Dest).Font:=FFont; end;久病成良医--多试 千人之诺诺,不如一士之谔谔--兼听 發表人 - mustapha.wang 於 2003/12/17 09:16:41
------
江上何人初见月,江月何年初照人 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |