ParentBackground如何在IDE生成的表单上工作?

Ser*_*yuz 4 delphi tform

此代码适用于VCL Forms应用程序中的IDE生成表单:

Self.ParentBackground := True;
Run Code Online (Sandbox Code Playgroud)


但为什么?对长辈无(TForm,TCustomForm,TScrollingWinControl)公布保护ParentBackground的财产TWinControl.表单顶部的表单(fi'TForm1')的类型声明也没有.确实如预期的那样

TForm(Self).ParentBackground := True;
Run Code Online (Sandbox Code Playgroud)

不编译("无法访问受保护的符号TWinControl.ParentBackground").与在运行时创建的任何表单相同.


注意:问题在于如何设置属性(BTW,还有其他的,如'Bevel [xxx]'),我想知道这是如何工作的.

Dav*_*nan 7

Self.ParentBackground := True;
Run Code Online (Sandbox Code Playgroud)

编译,因为类可以访问自己的受保护成员.

  • D'哦!谢谢! (2认同)