Override default Show behaviour / SetVisible of TForm's descendant (Delphi VCL)
I would like to alter the Show default behaviour of a TForm's descendant (for eg. instead of showing itself on the screen, I would like to place it on a page control as a new tabsheet). How to achive that ? I'd like to show it using a standard method (call Show method or set Visible property) so I tried to override the SetVisible method. But I found that the SetVisible cannot be overriden since it is a private method. Any suggestions where to override i开发者_如何学编程t ? Thanks.
You can override the protected TCustomForm.VisibleChanging.
There are two ways to do what I think you are asking, which is embedding a form in a panel or similar. There is a TForm.CreateParented(handle) function, but in our code we tend not to use that. Instead, we create the form with this sort of code:
MyForm := TMyForm.Create(Self);
MyForm.Parent := MyTabSheet;
MyForm.Border := bsNone;
MyForm.Align := alClient;
MyForm.Show;
精彩评论