As provided by the .NET SDK.
<System.Runtime.InteropServices.DllImportAttribute("gdi32.dll")> _
Private Shared Function Rectangle(hdc As IntPtr, _
ulCornerX As Integer, ulCornerY As Integer, lrCornerX As Integer, _
lrCornerY As Integer) As Boolean
End Function
Public Sub GetHdcForGDI(e As PaintEventArgs)
' Create pen.
Dim redPen As New Pen(Color.Red, 1)
' Draw rectangle with GDI+.
e.Graphics.DrawRectangle(redPen, 10, 10, 100, 50)
' Get handle to device context.
Dim hdc As IntPtr = e.Graphics.GetHdc()
' Draw rectangle with GDI using default pen.
Rectangle(hdc, 10, 70, 110, 120)
' Release handle to device context.
e.Graphics.ReleaseHdc(hdc)
End Sub