diff --git a/common/widgets/layer_box_selector.cpp b/common/widgets/layer_box_selector.cpp index ee8af8fb07..6a94bd0c35 100644 --- a/common/widgets/layer_box_selector.cpp +++ b/common/widgets/layer_box_selector.cpp @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -140,9 +141,12 @@ int LAYER_BOX_SELECTOR::SetLayerSelection( int layer ) void LAYER_BOX_SELECTOR::ResyncBitmapOnly() { + DPI_SCALING dpi( nullptr, this ); + int size = static_cast( dpi.GetScaleFactor() * 14 ); + for( int i = 0; i < (int) GetCount(); ++i ) { - wxBitmap layerbmp( 14, 14 ); + wxBitmap layerbmp( size, size ); DrawColorSwatch( layerbmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( i ) ); } } diff --git a/pcbnew/pcb_layer_box_selector.cpp b/pcbnew/pcb_layer_box_selector.cpp index 77633c8375..cefdc1c365 100644 --- a/pcbnew/pcb_layer_box_selector.cpp +++ b/pcbnew/pcb_layer_box_selector.cpp @@ -84,7 +84,8 @@ void PCB_LAYER_BOX_SELECTOR::Resync() Freeze(); Clear(); - const int BM_SIZE = 14; + DPI_SCALING dpi( nullptr, this ); + int size = static_cast( 14 / dpi.GetScaleFactor() ); LSET show = LSET::AllLayersMask() & ~m_layerMaskDisable; LSET activated = getEnabledLayers() & ~m_layerMaskDisable; @@ -99,7 +100,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync() else layerstatus.Empty(); - wxBitmap bmp( BM_SIZE, BM_SIZE ); + wxBitmap bmp( size, size ); DrawColorSwatch( bmp, getLayerColor( LAYER_PCB_BACKGROUND ), getLayerColor( layerid ) ); wxString layername = getLayerName( layerid ) + layerstatus; @@ -129,7 +130,7 @@ void PCB_LAYER_BOX_SELECTOR::Resync() SetMinSize( wxSize( -1, -1 ) ); wxSize bestSize = GetBestSize(); - bestSize.x = GetBestSize().x + BM_SIZE + 10; + bestSize.x = GetBestSize().x + size + 10; SetMinSize( bestSize ); SetSelection( wxNOT_FOUND );