@@ -30,7 +30,11 @@ public ScrollableControl()
30
30
public virtual bool AutoScroll
31
31
{
32
32
get { return GetScrollState ( ScrollStateAutoScrolling ) ; }
33
- set { SetScrollState ( ScrollStateAutoScrolling , value ) ; }
33
+ set
34
+ {
35
+ SetScrollState ( ScrollStateAutoScrolling , value ) ;
36
+ PerformLayout ( ) ;
37
+ }
34
38
}
35
39
public override Rectangle DisplayRectangle
36
40
{
@@ -113,13 +117,15 @@ internal void Native_EnableScrollBar(bool enable, int orientation)
113
117
{
114
118
if ( oriV && vscroll != null )
115
119
{
120
+ vscroll . Value = 0 ; // Reset view.
116
121
vscroll . ValueChanged -= Scroll_ValueChanged ;
117
122
vscroll . Dispose ( ) ;
118
123
vscroll = null ;
119
124
}
120
125
121
126
if ( oriH && hscroll != null )
122
127
{
128
+ hscroll . Value = 0 ; // Reset view.
123
129
hscroll . ValueChanged -= Scroll_ValueChanged ;
124
130
hscroll . Dispose ( ) ;
125
131
hscroll = null ;
@@ -137,6 +143,22 @@ internal ScrollBar GetScrollBar(int orientation)
137
143
return null ;
138
144
}
139
145
146
+ protected internal override void uwfOnLatePaint ( PaintEventArgs e )
147
+ {
148
+ if ( this is Form )
149
+ return ;
150
+ if ( vscroll == null || hscroll == null )
151
+ return ;
152
+
153
+ // Fill rect between two scrollbars.
154
+ var rx = hscroll . Location . X + hscroll . Width ;
155
+ var ry = vscroll . Location . Y + vscroll . Height ;
156
+ var rw = Width - rx ;
157
+ var rh = Height - ry ;
158
+
159
+ e . Graphics . uwfFillRectangle ( vscroll . BackColor , rx , ry , rw , rh ) ;
160
+ }
161
+
140
162
protected bool GetScrollState ( int bit )
141
163
{
142
164
return ( bit & scrollState ) == bit ;
@@ -223,9 +245,8 @@ private void UpdateScrolls()
223
245
var autoScroll = ( scrollState & ScrollStateAutoScrolling ) != 0 ;
224
246
if ( autoScroll == false )
225
247
{
226
- HorizontalScroll . UpdateScrollInfo ( ) ;
227
- VerticalScroll . UpdateScrollInfo ( ) ;
228
- UpdateScrollRects ( ) ;
248
+ Native_EnableScrollBar ( false , NativeMethods . SB_VERT ) ;
249
+ Native_EnableScrollBar ( false , NativeMethods . SB_HORZ ) ;
229
250
return ;
230
251
}
231
252
@@ -258,7 +279,6 @@ private void UpdateScrolls()
258
279
259
280
UpdateScrollRects ( ) ;
260
281
}
261
-
262
282
private void UpdateScrollRects ( )
263
283
{
264
284
var hRightOffset = 0 ;
@@ -279,26 +299,27 @@ private void UpdateScrollRects()
279
299
gripOriginLocation . Offset ( - vscroll . Width , 0 ) ;
280
300
if ( hscroll != null && vscroll == null )
281
301
gripOriginLocation . Offset ( 0 , - hscroll . Height ) ;
282
- if ( vscroll != null && hscroll != null )
283
- {
284
- hRightOffset += 14 ; // img.Width + bottomRight offset
285
- vBottomOffset += 14 ;
286
- }
287
-
302
+
288
303
form . uwfSizeGripRenderer . Location = gripOriginLocation ;
289
304
}
290
305
}
291
306
307
+ if ( vscroll != null && hscroll != null )
308
+ {
309
+ hRightOffset += 14 ;
310
+ vBottomOffset += 14 ;
311
+ }
312
+
292
313
if ( vscroll != null )
293
314
{
294
- vscroll . Location = new Point ( Width - vscroll . Width , vTopOffset ) ;
295
- vscroll . Height = Height - vTopOffset - vBottomOffset ;
315
+ vscroll . Location = new Point ( Width - vscroll . Width - 1 , vTopOffset - 1 ) ;
316
+ vscroll . Height = Height - vTopOffset - vBottomOffset - 2 ;
296
317
}
297
318
298
319
if ( hscroll != null )
299
320
{
300
- hscroll . Location = new Point ( 0 , Height - hscroll . Height ) ;
301
- hscroll . Width = Width - hRightOffset ;
321
+ hscroll . Location = new Point ( 1 , Height - hscroll . Height - 1 ) ;
322
+ hscroll . Width = Width - hRightOffset - 2 ;
302
323
}
303
324
}
304
325
}
0 commit comments