I have the following code behind a command button:

Dim OldBrush As Long
Dim OldPen As Long
Dim NewBrush As Long
Dim NewPen As Long
Dim Color As Long

Color = RGB(0, 0, 255)
NewPen = CreatePen(PS_SOLID, 3, Color)
OldPen = SelectObject(Form1.hdc, NewPen)
NewBrush = CreateSolidBrush(Color)
OldBrush = SelectObject(Form1.hdc, NewBrush)
Rectangle Form1.hdc, 50, 50, 100, 50
SelectObject Form1.hdc, OldBrush
SelectObject Form1.hdc, OldPen

DeleteObject NewPen

When I click the button, nothing happens at all.

P.S. I do have all the necessary declerations.