如何隐藏TGraphicControl子类的Width,Height属性? 如题,谢谢.解决立即可分 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 不能隐藏根据Delphi类的继承规则,子类从父类继承的属性的可见性只能保持或者变大比如 (下面代码从VCL中Copy来的)TControl = class(TComponent) published property Width: Integer read FWidth write SetWidth; property Height: Integer read FHeight write SetHeight;TGraphicControl = class(TControl)TImage = class(TGraphicControl)那么从TControl 继承的所有东东都自动包含属性Width 和Height,并且可见范围是 published,你不能改变它,因为已经是最大的可见范围对外部可见范围(小->大)private<protected<public<=published----------------unit Unit2;interfaceuses dialogs;type TBase=class(TObject) private FAge: integer; procedure SetAge(const Value: integer); protected property Age:integer read FAge write SetAge; end; TFirst=class(TBase) public property Age ; end; // 你可发现TSecond 与TFirst的区别只在于public ,published 关键字 //对于控件(就是设计期可以放到Form上面类)二者是不同的, //TSecond中Age可以通过属性编辑器 ,进行设计期 设置, //并可看见结果 ,另外还RTTI信息;而TFirst不能, TSecond=class(TBase) published property Age ; end; TThird=class(TFirst) //即使你重新声明,缩小范围,但是其可见范围还是public (父类的) private property Age ; //一般不会这样用 protected function s:integer; end;implementation{ TBase }procedure TBase.SetAge(const Value: integer);begin FAge:=Value; dialogs.ShowMessage('base property');end;{ TThird }function TThird.s: integer;begin Result:=Age;end;end. postren(小虫),hthunter(核桃-春天过去了……) 各100分 关于Listview---用listview显示房态图 帮忙! 如何得到控件image的句柄 谢谢 这句什么意思!? 请问与锁定计算机相关的API是哪些? http://216.239.39.102/ 这就是被封杀的Google 为什么richedit不能显示所有的信息? 下面的写法对吗 开始运行时怎样使子窗体不显示?怎样关闭子窗体? 谁能告诉我这句话什么意思?TstringGrid(DBGrid1).fixedcols:=3; 我在form1里定义函数aa,在form2调用怎么做?
根据Delphi类的继承规则,子类从父类继承的属性的可见性只能保持或者变大
比如 (下面代码从VCL中Copy来的)
TControl = class(TComponent)
published
property Width: Integer read FWidth write SetWidth;
property Height: Integer read FHeight write SetHeight;
TGraphicControl = class(TControl)
TImage = class(TGraphicControl)
那么从TControl 继承的所有东东都自动包含属性Width 和Height,并且可见范围是 published,你不能改变它,因为已经是最大的可见范围
对外部可见范围(小->大)
private<protected<public<=published
----------------
unit Unit2;interface
uses dialogs;
type
TBase=class(TObject)
private
FAge: integer;
procedure SetAge(const Value: integer);
protected
property Age:integer read FAge write SetAge;
end; TFirst=class(TBase)
public
property Age ;
end;
// 你可发现TSecond 与TFirst的区别只在于public ,published 关键字
//对于控件(就是设计期可以放到Form上面类)二者是不同的,
//TSecond中Age可以通过属性编辑器 ,进行设计期 设置,
//并可看见结果 ,另外还RTTI信息;而TFirst不能,
TSecond=class(TBase)
published
property Age ;
end; TThird=class(TFirst)
//即使你重新声明,缩小范围,但是其可见范围还是public (父类的)
private
property Age ; //一般不会这样用
protected
function s:integer;
end;
implementation{ TBase }procedure TBase.SetAge(const Value: integer);
begin
FAge:=Value;
dialogs.ShowMessage('base property');
end;{ TThird }function TThird.s: integer;
begin
Result:=Age;
end;end.