Hi,

I'm creating a dashed rectangle using the following code:

Code:
    Dim hPen As Long, hOldPen As Long
    Dim hBrush As Long, hOldBrush As Long
    Dim hScreenDC As Long, nDrawMode As Long
    
    '-- Get DC of entire screen in order to draw on top of all controls
    hScreenDC = GetDC(0)
    '-- Select GDI object
    hPen = CreatePen(PS_DASH, 0, RGB(0, 0, 0))
    hOldPen = SelectObject(hScreenDC, hPen)
    '-- Draw rectangle
    Rectangle hScreenDC, miSelectX1, miSelectY1, miSelectX2, miSelectY2
    '-- Restore DC
    SelectObject hScreenDC, hOldPen
    ReleaseDC 0, hScreenDC
    '-- Delete GDI objects
    DeleteObject hPen
However, it's creating a white background and the dash lengths are too long. Take a look at the first rectangle below.

What I want it to look like is the second rectangle where the dashes are shorter and the background is transparent to show the underlying form color.



Any help would be appreciated..

Dan