みなさん、こんにちは。
私現在ビジュアルコンポーネントを作成しています。
このコンポーネントを貼り付けたときに
Height、Width を固定で変更できないようにしたいのです。
つまり、Property Height、または、Property Width を
設計時のプロパティから削除(見えなくする)をしたいのですが
可能でしょうか?
いろいろためしてみました
以下のようにすると表示はされなくなるんですけど
Height、Width に初期値として入力(コンストラクタで設定)した値が
設定されません。
隠蔽しながら、かつ、内部ではデータを変更(設定)できるように
したいのですけど。
private
FHeight: Integer;
FWidth: Integer;
protected
public
constructor Create(Owner: TComponent); override;
published
property Height: Integer write FHeight;
property Width: Integer write FWidth;
end;
:
:
constructor TWCompo.Create(Owner: TComponent);
begin
inherited Create(Owner);
Height := 39;
Width := 39;
end;
できないようですね。
Public にしている継承元をたどってその継承元から
派生させたコンポーネントを作る以外は不可能のようでした。
解決チェック忘れました・・
property Height: Integer write FHeight;
property Width: Integer write FWidth;
を
private
か
protected
においたらいいでしょ?
ツイート | ![]() |