Fix drawing of non-solid lines with width 0 using wxDC in wxMSW

::ExtCreatePen() doesn't allow the pen width to be 0, unlike
::CreatePen() and failed to create the brush in this case.

Use width of 1 to draw e.g. hatched lines of width 0 correctly.

See #7097.
This commit is contained in:
Anton Triest
2020-03-27 12:02:36 +01:00
committed by Vadim Zeitlin
parent d245dc9e1f
commit 53d51105be

View File

@@ -356,7 +356,10 @@ bool wxPenRefData::Alloc()
dash = NULL;
}
m_hPen = ::ExtCreatePen(styleMSW, m_width, &lb, m_nbDash, (LPDWORD)dash);
// Note that width can't be 0 for ExtCreatePen(), unlike for CreatePen().
int width = m_width == 0 ? 1 : m_width;
m_hPen = ::ExtCreatePen(styleMSW, width, &lb, m_nbDash, (LPDWORD)dash);
delete [] dash;
}