Width of sub-label is calculated by using of GetTextExtent() instead of PaintDC->GetMultiLineTextExtent, because of PaintDC is not OK sometimes.
For example on GTK3 PaintDC->IsOk() only, when it's using in a native paint event
see https://github.com/wxWidgets/wxWidgets/blob/master/src/gtk/dc.cpp, line 346
This commit is contained in:
YuSanka 2020-11-11 12:04:15 +01:00
parent aa32f48c9c
commit a2b915af0f

View file

@ -173,9 +173,9 @@ wxPoint OG_CustomCtrl::get_pos(const Line& line, Field* field_in/* = nullptr*/)
_CTX(option.label, "Layers") : _(option.label);
label += ":";
wxPaintDC dc(this);
dc.SetFont(m_font);
h_pos += dc.GetMultiLineTextExtent(label).x + m_h_gap;
wxCoord label_w, label_h;
GetTextExtent(label, &label_w, &label_h, 0, 0, &m_font);
h_pos += label_w + 1 + m_h_gap;
}
h_pos += 3 * blinking_button_width;