我需要在表单的 FormStyle 属性更改之前进行一些处理,但 TForm.SetFormStyle (属性设置器)是私有的,有没有办法覆盖该属性但仍然可以访问父类属性?
TMyForm = class(TForm)
private
procedure MySetFormStyle(Style: TFormStyle);
public
property FormStyle: TFormStyle read Parent.FormStyle write MySetFormStyle;
end;
TMyForm.MySetFormStyle(Style: TFormStyle);
begin
if Parent.FormStyle <> Style then
DoSomething;
Parent.FormStyle := Style;
end;
我用的是delphi 2010