Previous | Index | Next 

[PRB] VB.NET forms don’t display the size grip handle

By default, a resizable .NET form displays a size grip handle in the lower right corner. You might have noticed that resizable forms in converted VB.NET applications don’t include such a handle. This behavior is by design and has been implemented because the handle causes additional WM_ERASEBKGROUND messages, which in turn have the undesirable effect of clearing any graphic output that was created on the form’s surface as well as on the surface of any PictureBox and UserControl hosted on the form.

You can restore the size grip handle by setting the following property in the handler of the form Load event, for example by means of an InsertStatement pragma:

        Private Sub Form_Load()
            '## InsertStatement Me.SizeGripStyle = Windows.Forms.SizeGripStyle.Auto
            ' …
        End Sub

You can safely add this statement if any of the following conditions is met:

  1. you don’t execute graphic methods – Line, Circle, PaintPicture, etc. – to display graphics on the form (or on any of its child controls)
  2. the form or the child control’s AutoRedraw property is set to True
  3. all the graphic methods are executed in the event handler for the Paint event of the form or the child control

If you create your graphic inside the Paint event handler (third case), keep in mind that you will experience more flickering than usual.


Previous | Index | Next