Draw CaptionButton on the windows form using vb.net

You can draw the specified button control with caption in the specified state, on the specified graphics surface, and within the specified bounds with the help of ControlPaint.DrawCaptionButton Method using vb.net

You can use ControlPaint.DrawCaptionButton Method like as :

Public Shared Sub DrawGrid ( grp As Graphics,area As Rectangle, _
pixelsBetweenDots As Size, backColor As Color )


Following example draw a button with specified caption on windows form:

Private Sub Form1_Paint(ByVal sender As System.Object, _
                            ByVal e As System.Windows.Forms.PaintEventArgs) _
                            Handles MyBase.Paint
        ControlPaint.DrawCaptionButton(e.Graphics, New Rectangle(50, 50, 50, 50), CaptionButton.Close, ButtonState.Checked)
End Sub