@@ -102,7 +102,6 @@ public partial class ViewerCanvas : DXCanvas
102102
103103 // checkerboard
104104 private CheckerboardMode _checkerboardMode = CheckerboardMode . None ;
105- private float _checkerboardCellSize = 10f ;
106105 private Color _checkerboardColor1 = Color . Black . WithAlpha ( 25 ) ;
107106 private Color _checkerboardColor2 = Color . White . WithAlpha ( 25 ) ;
108107
@@ -724,26 +723,6 @@ public CheckerboardMode CheckerboardMode
724723 }
725724
726725
727- [ Category ( "Checkerboard" ) ]
728- [ DefaultValue ( typeof ( float ) , "10" ) ]
729- public float CheckerboardCellSize
730- {
731- get => _checkerboardCellSize ;
732- set
733- {
734- if ( _checkerboardCellSize != value )
735- {
736- _checkerboardCellSize = value ;
737-
738- // reset checkerboard brush
739- DisposeCheckerboardBrushes ( ) ;
740-
741- Invalidate ( ) ;
742- }
743- }
744- }
745-
746-
747726 [ Category ( "Checkerboard" ) ]
748727 [ DefaultValue ( typeof ( Color ) , "25, 0, 0, 0" ) ]
749728 public Color CheckerboardColor1
@@ -882,7 +861,7 @@ public Color NavButtonColor
882861 /// </summary>
883862 [ Browsable ( false ) ]
884863 [ DesignerSerializationVisibility ( DesignerSerializationVisibility . Hidden ) ]
885- public SizeF NavButtonSize { get ; set ; } = new ( 60f , 60f ) ;
864+ public SizeF NavButtonSize => this . ScaleToDpi ( new SizeF ( 50f , 50f ) ) ;
886865
887866
888867 /// <summary>
@@ -896,9 +875,7 @@ public WicBitmapSource? NavLeftImage
896875 {
897876 // _wicNavLeftImage is a ref, do not dispose here
898877 _wicNavLeftImage = value ;
899-
900878 DXHelper . DisposeD2D1Bitmap ( ref _d2dNavLeftImage ) ;
901- _d2dNavLeftImage = DXHelper . ToD2D1Bitmap ( Device , _wicNavLeftImage ) ;
902879 }
903880 }
904881
@@ -914,9 +891,7 @@ public WicBitmapSource? NavRightImage
914891 {
915892 // _wicNavRightImage is a ref, do not dispose here
916893 _wicNavRightImage = value ;
917-
918894 DXHelper . DisposeD2D1Bitmap ( ref _d2dNavRightImage ) ;
919- _d2dNavRightImage = DXHelper . ToD2D1Bitmap ( Device , _wicNavRightImage ) ;
920895 }
921896 }
922897
@@ -1114,16 +1089,10 @@ protected override void OnDeviceCreated(DeviceCreatedReason reason)
11141089 {
11151090 base . OnDeviceCreated ( reason ) ;
11161091
1117- // re-create Direct2D left nav icon
1092+ // dispose the Direct2D resource of the old device
11181093 DXHelper . DisposeD2D1Bitmap ( ref _d2dNavLeftImage ) ;
1119- _d2dNavLeftImage = DXHelper . ToD2D1Bitmap ( Device , _wicNavLeftImage ) ;
1120-
1121- // re-create Direct2D right nav icon
11221094 DXHelper . DisposeD2D1Bitmap ( ref _d2dNavRightImage ) ;
1123- _d2dNavRightImage = DXHelper . ToD2D1Bitmap ( Device , _wicNavRightImage ) ;
1124-
11251095
1126- // dispose the Direct2D resource of the old device
11271096 if ( reason != DeviceCreatedReason . FirstTime )
11281097 {
11291098 // dispose checkerboard
@@ -1808,7 +1777,7 @@ protected virtual void DrawCheckerboardLayer(DXGraphics g)
18081777
18091778
18101779 // create bitmap brush
1811- _checkerboardBrushD2D ??= VHelper . CreateCheckerBoxTileD2D ( Device , CheckerboardCellSize , CheckerboardColor1 , CheckerboardColor2 ) ;
1780+ _checkerboardBrushD2D ??= VHelper . CreateCheckerBoxTileD2D ( Device , this . ScaleToDpi ( Const . VIEWER_GRID_SIZE ) , CheckerboardColor1 , CheckerboardColor2 ) ;
18121781
18131782 // draw checkerboard
18141783 Device . FillRectangle ( DXHelper . ToD2DRectF ( region ) , _checkerboardBrushD2D ) ;
@@ -2119,6 +2088,8 @@ protected virtual void DrawNavigationLayer(DXGraphics g)
21192088 {
21202089 if ( _navLeftState != DXButtonStates . Normal )
21212090 {
2091+ _d2dNavLeftImage ??= DXHelper . ToD2D1Bitmap ( Device , _wicNavLeftImage ) ;
2092+
21222093 // draw background
21232094 VHelper . DrawDXButton ( g ,
21242095 new RectangleF ( )
@@ -2143,6 +2114,9 @@ protected virtual void DrawNavigationLayer(DXGraphics g)
21432114 {
21442115 if ( _navRightState != DXButtonStates . Normal )
21452116 {
2117+ _d2dNavRightImage ??= DXHelper . ToD2D1Bitmap ( Device , _wicNavRightImage ) ;
2118+
2119+
21462120 // draw background
21472121 VHelper . DrawDXButton ( g ,
21482122 new RectangleF ( )
0 commit comments