AdvSearchEdit - dynamic value DrowDownWidth

I would like to set a dynamic value DropDownWidth as shown below


I'm using the code

void __fastcall TForm1::AdvSearchEdit1BeforeDropDown(TObject *Sender)
AdvSearchEdit1->DropDownWidth = AdvSearchEdit1->Width - AdvSearchEdit1->SearchButton->Width;

Everything works fine if DPI=96. However, if DPI > 96, it looks like below.


How to set DropDownWidth to be always displayed as in picture 1 regardless of DPI?

When you set the width in code at runtime, you'll need to take the DPI in account and divide the width you want to set by the DPI ratio.