delphi - how to create a TCustomControl that behaves like Tpanel? -


How do I create a TCustomControl which will behave like Teppel? Like MyCustomComponent, that I can skip components like labels, images etc. In the code TCustomPanel:

  Producer TCustomPanel.Create (AOwner: TComponent); Start inheriting (AoONar); ControlStyle: = [csAcceptpts control {, ...}]; //... End;  

There are several more VCL controls that you can enter from your csAccepts Controls to ControlStyle property.

If you want to control it, but get out of such VCL control, then you should do something like this:

  1. Build Creator Override
  2. Add csAcceptptsControls to ControlStyle property

Like this sample code:

  // MMWIN: subscription scheme _mm_copy_buffer_; Interface Type TMyCustomControl = Class (TSomeControl) Build Public Builder (AOwner: TComponent); Override; End; Implementation {TMyCustomControl} creator TMyCustomControl.Creatate (AOwner: TComponent); Start inheriting (AoONar); ControlStyle: = ControlStyle + [csAcceptptsControls {, ...}]; //... End; End.  

- Jeron


Comments