wxWindow::GetTextExtent

void GetTextExtent(char *string, int *x, int *y)

Gets the width and height of the string as it would be drawn on the window with the currently selected font.