@@ -1819,9 +1819,15 @@ private void RefreshModCards()
18191819 {
18201820 HideSkeletonLoaders ( ) ;
18211821 if ( panelStore . IsHandleCreated )
1822+ {
18221823 panelStore . RefreshScrollbars ( ) ;
1824+ panelStore . PerformLayout ( ) ;
1825+ }
18231826 if ( panelInstalled . IsHandleCreated )
1827+ {
18241828 panelInstalled . RefreshScrollbars ( ) ;
1829+ panelInstalled . PerformLayout ( ) ;
1830+ }
18251831 UpdateStats ( ) ;
18261832 UpdateHeaderInfo ( ) ;
18271833 return ;
@@ -2433,11 +2439,47 @@ private void RefreshModCards()
24332439 UpdateStats ( ) ;
24342440 UpdateHeaderInfo ( ) ;
24352441
2436- // Refresh scrollbars
2442+ // Refresh scrollbars and force layout recalculation
24372443 if ( panelStore . IsHandleCreated )
2444+ {
2445+ // Force recalculation of preferred size by temporarily disabling/enabling AutoScroll
2446+ var wasAutoScroll = panelStore . AutoScroll ;
2447+ panelStore . AutoScroll = false ;
2448+ panelStore . AutoScroll = wasAutoScroll ;
24382449 panelStore . RefreshScrollbars ( ) ;
2450+ panelStore . PerformLayout ( ) ;
2451+ // Reset scroll position if content is smaller than viewport
2452+ if ( panelStore . VerticalScroll . Visible && panelStore . VerticalScroll . Value > 0 )
2453+ {
2454+ var contentHeight = panelStore . Controls . Cast < Control > ( ) . Any ( )
2455+ ? panelStore . Controls . Cast < Control > ( ) . Max ( c => c . Bottom )
2456+ : 0 ;
2457+ if ( contentHeight <= panelStore . ClientSize . Height )
2458+ {
2459+ panelStore . AutoScrollPosition = new Point ( 0 , 0 ) ;
2460+ }
2461+ }
2462+ }
24392463 if ( panelInstalled . IsHandleCreated )
2464+ {
2465+ // Force recalculation of preferred size by temporarily disabling/enabling AutoScroll
2466+ var wasAutoScroll = panelInstalled . AutoScroll ;
2467+ panelInstalled . AutoScroll = false ;
2468+ panelInstalled . AutoScroll = wasAutoScroll ;
24402469 panelInstalled . RefreshScrollbars ( ) ;
2470+ panelInstalled . PerformLayout ( ) ;
2471+ // Reset scroll position if content is smaller than viewport
2472+ if ( panelInstalled . VerticalScroll . Visible && panelInstalled . VerticalScroll . Value > 0 )
2473+ {
2474+ var contentHeight = panelInstalled . Controls . Cast < Control > ( ) . Any ( )
2475+ ? panelInstalled . Controls . Cast < Control > ( ) . Max ( c => c . Bottom )
2476+ : 0 ;
2477+ if ( contentHeight <= panelInstalled . ClientSize . Height )
2478+ {
2479+ panelInstalled . AutoScrollPosition = new Point ( 0 , 0 ) ;
2480+ }
2481+ }
2482+ }
24412483 }
24422484 finally
24432485 {
0 commit comments