@@ -21,6 +21,8 @@ public partial class StatusStrip : ToolStrip
21
21
private static readonly int s_stateCalledSpringTableLayout = BitVector32 . CreateMask ( s_stateSizingGrip ) ;
22
22
23
23
private const int GripWidth = 12 ;
24
+ private const int GripHeight = 22 ;
25
+
24
26
private RightToLeftLayoutGrip ? _rtlLayoutGrip ;
25
27
private Orientation _lastOrientation = Orientation . Horizontal ;
26
28
@@ -70,14 +72,7 @@ protected override Padding DefaultPadding
70
72
{
71
73
if ( Orientation == Orientation . Horizontal )
72
74
{
73
- if ( RightToLeft == RightToLeft . No )
74
- {
75
- return new Padding ( 1 , 0 , 14 , 0 ) ;
76
- }
77
- else
78
- {
79
- return new Padding ( 14 , 0 , 1 , 0 ) ;
80
- }
75
+ return RightToLeft == RightToLeft . No ? new Padding ( 1 , 0 , 14 , 0 ) : new Padding ( 14 , 0 , 1 , 0 ) ;
81
76
}
82
77
else
83
78
{
@@ -201,24 +196,30 @@ public Rectangle SizeGripBounds
201
196
{
202
197
get
203
198
{
204
- if ( SizingGrip )
199
+ if ( ! SizingGrip )
205
200
{
206
- Size statusStripSize = Size ;
207
- // we can't necessarily make this the height of the status strip, as
208
- // the orientation could change.
209
- int gripHeight = Math . Min ( DefaultSize . Height , statusStripSize . Height ) ;
210
-
211
- if ( RightToLeft == RightToLeft . Yes )
212
- {
213
- return new Rectangle ( 0 , statusStripSize . Height - gripHeight , GripWidth , gripHeight ) ;
214
- }
215
- else
216
- {
217
- return new Rectangle ( statusStripSize . Width - GripWidth , statusStripSize . Height - gripHeight , GripWidth , gripHeight ) ;
218
- }
201
+ return Rectangle . Empty ;
219
202
}
220
203
221
- return Rectangle . Empty ;
204
+ Size statusStripSize = Size ;
205
+ Rectangle clientRect = ClientRectangle ;
206
+
207
+ int scaledGripHeight = ScaleHelper . ScaleToDpi ( GripHeight , DeviceDpi ) ;
208
+ int scaleGripWidth = ScaleHelper . ScaleToDpi ( GripWidth , DeviceDpi ) ;
209
+
210
+ scaledGripHeight = Math . Min ( scaledGripHeight , clientRect . Height ) ;
211
+
212
+ return RightToLeft == RightToLeft . Yes
213
+ ? new Rectangle (
214
+ x : 0 ,
215
+ y : statusStripSize . Height - scaledGripHeight ,
216
+ width : scaleGripWidth ,
217
+ height : scaledGripHeight )
218
+ : new Rectangle (
219
+ x : statusStripSize . Width - scaleGripWidth ,
220
+ y : statusStripSize . Height - scaledGripHeight ,
221
+ width : scaleGripWidth ,
222
+ height : scaledGripHeight ) ;
222
223
}
223
224
}
224
225
@@ -303,14 +304,9 @@ internal override Size GetPreferredSizeCore(Size proposedSize)
303
304
proposedSize . Height = int . MaxValue ;
304
305
}
305
306
306
- if ( Orientation == Orientation . Horizontal )
307
- {
308
- return GetPreferredSizeHorizontal ( this , proposedSize ) + Padding . Size ;
309
- }
310
- else
311
- {
312
- return GetPreferredSizeVertical ( this ) + Padding . Size ;
313
- }
307
+ return Orientation == Orientation . Horizontal
308
+ ? GetPreferredSizeHorizontal ( this , proposedSize ) + Padding . Size
309
+ : GetPreferredSizeVertical ( this ) + Padding . Size ;
314
310
}
315
311
316
312
return base . GetPreferredSizeCore ( proposedSize ) ;
@@ -584,15 +580,9 @@ protected override void WndProc(ref Message m)
584
580
PInvokeCore . GetClientRect ( rootHwnd , out RECT rootHwndClientArea ) ;
585
581
586
582
// map the size grip FROM statusStrip coords TO the toplevel window coords.
587
- Point gripLocation ;
588
- if ( RightToLeft == RightToLeft . Yes )
589
- {
590
- gripLocation = new Point ( SizeGripBounds . Left , SizeGripBounds . Bottom ) ;
591
- }
592
- else
593
- {
594
- gripLocation = new Point ( SizeGripBounds . Right , SizeGripBounds . Bottom ) ;
595
- }
583
+ Point gripLocation = RightToLeft == RightToLeft . Yes
584
+ ? new Point ( SizeGripBounds . Left , SizeGripBounds . Bottom )
585
+ : new Point ( SizeGripBounds . Right , SizeGripBounds . Bottom ) ;
596
586
597
587
PInvokeCore . MapWindowPoints ( this , rootHwnd , ref gripLocation ) ;
598
588
0 commit comments