How to use ControlPaint to draw Grab Handles and a Grid

  • Thread starter Thread starter Charles Law
  • Start date Start date
C

Charles Law

The ControlPaint class looks like the ideal way to draw grab handles, a
grid, and other designer-like stuff in a windows form, but I can't make it
work.

I realise I need to use SetStyle to set the UserPaint bit, but the method is
protected on a textbox, for example, so I can't call it.

If I call it for the form, and use DrawGrid, I get nothing. For example, in
the form Load event

<code>
Me.SetStyle(ControlStyles.UserPaint, True)
Me.UpdateStyles()

ControlPaint.DrawGrid(Drawing.Graphics.FromHwnd(Me.Handle), New
Rectangle(Me.Location, Me.Size), New Size(10, 10), Color.AliceBlue)
</code>

The MSDN implies that this is all I need do, but it doesn't work.

Can anyone suggest where I am going wrong?

TIA

Charles
 
Back
Top