Search code examples
delphidelphi-2010vcl

Align a component exactly in the middle of a panel


I have a TRichEdit and a TButton on a TPanel, which is not aligned in the centre of the panel:

enter image description here

Is there a quicker way to align these components in the centre of the panel, than just by dragging it around and guessing if it is in the centre? Also, I am using Delphi 2010.

I tried selecting the components and using the alignment options: Alignment options

But it only aligned the button to the rich edit: Button aligned


Solution

  • First, you must not select the panel, because that is not involved in this process.

    Second, there is another toolbar Position that has a button to center the selected elements inside its parent.

    I have no Delphi 2010 at hand, so I cannot provide a screenshot, but both icons look quite similar.