{******************************************************************************* 文字列リソースコンポーネント TStringResource 備考: 設計時にTStringListを確保出来るので 文字列のリソースだけ欲しいときには有用かな。 履歴: 2000/07/12作成 2001/09/14 D6対応によって実装部と設計部(PropertyEditor部)の分離を行なう TDefaultEditorの実装が変更されていたので修正 *******************************************************************************} unit StringResource; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs; type TStringResource = class(TComponent) private FLines: TStrings; FCaption: String; procedure SetLines(const Value: TStrings); function GetCaption: String; procedure SetCaption(const Value: String); protected public constructor Create(AOwner: TComponent); override; destructor Destroy; override; {↑TComponentの宣言が constructor Create(AOwner: TComponent); virtual; destructor Destroy; override; のようになっているのでコンストラクタoverrideするのがよい} published property Lines: TStrings read FLines write SetLines; property Caption: String read GetCaption write SetCaption; end; implementation { TStringResource } //------------------------------- //初期化・終了コード constructor TStringResource.Create(AOwner: TComponent); begin inherited; FLines := TStringList.Create; end; destructor TStringResource.Destroy; begin FLines.Free; inherited; end; //------------------------------- //Linesプロパティアクセスメソッド procedure TStringResource.SetLines(const Value: TStrings); begin FLines.Assign(Value); end; function TStringResource.GetCaption: String; begin Result := FCaption; end; procedure TStringResource.SetCaption(const Value: String); begin FCaption := Value; end; end.