Fix off-by-ones with bottom and right aligned positioning
wxDC::DrawLabel() positions the text one to the left with wxALIGN_RIGHT alignment and one up with wxALIGN_BOTTOM alignment. The same occurs in wxControlRenderer::DrawBitmap() for bitmaps. Both off-by-ones exist since inception in respectively4d3c4c2f94
andbc60c3d699
. This fix vertically aligns wxALIGN_BOTTOM drawing of wxDC::DrawLabel() with themed text drawing through wxRendererXP::DrawItemText().
This commit is contained in:
@@ -1196,7 +1196,7 @@ void wxDC::DrawLabel(const wxString& text,
|
||||
wxCoord x, y;
|
||||
if ( alignment & wxALIGN_RIGHT )
|
||||
{
|
||||
x = rect.GetRight() - width;
|
||||
x = rect.GetRight() - width + 1;
|
||||
}
|
||||
else if ( alignment & wxALIGN_CENTRE_HORIZONTAL )
|
||||
{
|
||||
@@ -1209,7 +1209,7 @@ void wxDC::DrawLabel(const wxString& text,
|
||||
|
||||
if ( alignment & wxALIGN_BOTTOM )
|
||||
{
|
||||
y = rect.GetBottom() - height;
|
||||
y = rect.GetBottom() - height + 1;
|
||||
}
|
||||
else if ( alignment & wxALIGN_CENTRE_VERTICAL )
|
||||
{
|
||||
|
@@ -185,7 +185,7 @@ void wxControlRenderer::DrawBitmap(wxDC &dc,
|
||||
{
|
||||
if ( alignment & wxALIGN_RIGHT )
|
||||
{
|
||||
x = rect.GetRight() - width;
|
||||
x = rect.GetRight() - width + 1;
|
||||
}
|
||||
else if ( alignment & wxALIGN_CENTRE )
|
||||
{
|
||||
@@ -198,7 +198,7 @@ void wxControlRenderer::DrawBitmap(wxDC &dc,
|
||||
|
||||
if ( alignment & wxALIGN_BOTTOM )
|
||||
{
|
||||
y = rect.GetBottom() - height;
|
||||
y = rect.GetBottom() - height + 1;
|
||||
}
|
||||
else if ( alignment & wxALIGN_CENTRE_VERTICAL )
|
||||
{
|
||||
|
Reference in New Issue
Block a user