How to write a getTightBounds() for DirectGUI

It seems to be doing what I want now thanks once again to the help from you guys.