*-- hPatBrush = this.CreateBrush() *-- hmmm.... not working. let's keep it the way *-- it was: the brush gets created and deleted() *-- everytime this method is calledLet's make it work. CreateBrush() method doesn't have to returned the value because you already put the handle into hBrush property. So, call the CreateBrush() method from Init / MouseDown.
** change this line hOldBrush = SelectObject( hDC, hPatBrush ) ** with this hOldBrush = SelectObject( hDC, This.hBrush )Then call the DestroyBrush() on Destroy / MouseUp.
#Define PS_SOLID 0 #Define PS_INSIDEFRAME 6 #Define COLORREF Long ** Create the pen Declare HANDLE CreatePen in GDI32 ; Integer fnPenStyle, Integer nWidth, COLORREF crColor hPen = CreatePen( PS_SOLID + PS_INSIDEFRAME, SysMetric(3), RGB(0,0,0) ) ** On draw hOldPen = SelectObject( hDC, hPen ) ** On destroy DeleteObject( hPen )BTW, the dotted corner looks very nice :-)