Search code examples
delphidelphi-xe4

Delphi - TCustomControl - can it show dotted rectangle when got focus?


I'm coding an tExCustomControl, which in turn, I use to derive other custom controls. Assuming I have a tExButton inherited from tExCustomcontrol, I wonder how can I make the base class tExCustomControl show the dotted rectangle, when issuing a SetFocus to the derived class tExButton.


Solution

  • In the overridden Paint method for the control, call DrawFocusRect if the control has the focus.