Add wxDPIChangedEvent::Scale() and use it in this event handlers
This is more concise and less error-prone than multiplying/dividing DPI values manually. No real changes except, maybe, in wxSlider code where the rounding was done differently before for some reason.
This commit is contained in:
@@ -446,9 +446,10 @@ void wxListCtrl::OnDPIChanged(wxDPIChangedEvent &event)
|
||||
for ( int i = 0; i < numCols; ++i )
|
||||
{
|
||||
int width = GetColumnWidth(i);
|
||||
if ( width > 0 )
|
||||
width = width * event.GetNewDPI().x / event.GetOldDPI().x;
|
||||
SetColumnWidth(i, width);
|
||||
if ( width <= 0 )
|
||||
continue;
|
||||
|
||||
SetColumnWidth(i, event.ScaleX(width));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user