Search code examples
c++windowswinapigdipen

How do I draw a fine line like TreeView


I would like to be able to draw a file line using native Windows API (LineTo) like the one that TreeView uses to connect nodes to each other. But using RS_DOT to create the brush (::CreatePen(PS_DOT, 0, RGB(200, 200, 200))), produces a different kind of line. Does anyone know how I can draw such a line?


Solution

  • Creating a true dotted pen

    LOGBRUSH LogBrush;
    LogBrush.lbColor = c_colorGridLine;
    LogBrush.lbStyle = PS_SOLID;
    penDotted.CreatePen( PS_COSMETIC | PS_ALTERNATE , 1, &LogBrush, 0, NULL );