At a guess....

GetDC() of the edit.

It should have a Font in the DC.

Use GetTextExtent() to find the size of a given string within the edit.

Inflate the size to account for a border.

ReleaseDC()

Resize control with MoveWindow() or SetWindowPos()