Tim,
Thanks for your code! I'll look at it later. What I found is the height of grip has something to do with dxf group code 46, which is not documented in the DXF Reference. When the value for group code 46 is changed, the height of grip is changed accordingly. But the BackgroundMask does not resize automatically.
Update:
The BackgroundMask is resized after close and re-open the drawing.