Can someone please explain me which control is better to create custom componens? What is the difference between twincontrol and tcustomcontrol?
Thank you in advance
Can someone please explain me which control is better to create custom componens? What is the difference between twincontrol and tcustomcontrol?
Thank you in advance
That depends on what kind of component you are making and what its requires are.
Is it visual?
If no, use
TComponent.if yes, does it need its own
HWND(input focus, window messages, etc)?If no, use
TGraphicControl.If yes, does it need to custom paint itself?
if yes, use
TCustomControl.if no, use
TWinControl.TCustomControlis aTWinControldescendant that adds some additional handling for theWM_PAINTmessage, on top of whatTWinControldoes.TCustomControlexposes a publicCanvasproperty that you can draw on. During painting, it enables thecsCustomPaintflag in theControlStateproperty, and then calls a virtualPaint()method that your component can override. So the benefit ofTCustomControlis that it makes custom painting a little easier to manage. Nothing more.