improve code for grid drawing of ffndbdebugDlg