The use of dotted pens and dashed pens raises an interesting question: What happens to the gaps between the dots and the dashes? The coloring of the gaps depends on both the background mode and the background color attributes defined in the device context. The default background mode is OPAQUE, which means that Windows fills in the gaps with the background color, which by default is white. This is consistent with the WHITE_BRUSH that many programs use in the window class for erasing the background of the window.
You can change the background color that Windows uses to fill in the gaps by calling:
SetBkColor (hdc, rgbColor) ;
As with the rgbColor value used for the pen color, Windows converts this background color to a pure color. You can obtain the current background color defined in the device context by calling GetBkColor.
You can also prevent Windows from filling in the gaps by changing the background mode to TRANSPARENT:
SetBkMode (hdc, TRANSPARENT) ;
Windows will ignore the background color and will not fill in the gaps. You can obtain the current background mode (either TRANSPARENT or OPAQUE) by calling GetBkMode.