Draw controls with the help of ControlPaint class in vb.net

 
Following example code describe how to draw different types of windows control with the help of ControlPaint class in vb.net.

Private Sub Form1_Paint(ByVal sender As System.Object, _
                            ByVal e As System.Windows.Forms.PaintEventArgs) _
                            Handles MyBase.Paint
        ControlPaint.DrawCheckBox(e.Graphics, New Rectangle(70, 10, 30, 30), ButtonState.Normal)
        ControlPaint.DrawCheckBox(e.Graphics, New Rectangle(120, 10, 20, 20), ButtonState.Checked)
        ControlPaint.DrawCheckBox(e.Graphics, New Rectangle(200, 10, 20, 20), ButtonState.Pushed)
 
        ControlPaint.DrawFocusRectangle(e.Graphics, New Rectangle(50, 50, 20, 20))
 
        ControlPaint.DrawButton(e.Graphics, New Rectangle(50, 100, 50, 20), ButtonState.Flat)
        ControlPaint.DrawButton(e.Graphics, New Rectangle(120, 100, 50, 20), ButtonState.Checked)
        ControlPaint.DrawButton(e.Graphics, New Rectangle(200, 100, 50, 20), ButtonState.Pushed)
 
        ControlPaint.DrawGrid(e.Graphics, New Rectangle(10, 120, 250, 50), New Size(5, 5), Color.Blue)
        ControlPaint.DrawScrollButton(e.Graphics, New Rectangle(50, 180, 20, 20), ScrollButton.Max, ButtonState.Pushed)
        ControlPaint.DrawScrollButton(e.Graphics, New Rectangle(90, 180, 20, 20), ScrollButton.Up, ButtonState.Normal)
        ControlPaint.DrawScrollButton(e.Graphics, New Rectangle(10, 180, 20, 20), ScrollButton.Left, ButtonState.Normal)
 
        ControlPaint.DrawMenuGlyph(e.Graphics, New Rectangle(50, 220, 20, 20), MenuGlyph.Checkmark)
        ControlPaint.DrawMenuGlyph(e.Graphics, New Rectangle(10, 220, 20, 20), MenuGlyph.Arrow)
        ControlPaint.DrawMenuGlyph(e.Graphics, New Rectangle(90, 220, 20, 20), MenuGlyph.Max)
 
        ControlPaint.DrawRadioButton(e.Graphics, New Rectangle(90, 260, 20, 20), ButtonState.Checked)
        ControlPaint.DrawRadioButton(e.Graphics, New Rectangle(150, 260, 20, 20), ButtonState.Flat)
End Sub