@@ -1019,12 +1019,10 @@ private void UpdateItems()
10191019 // Set the position of the rectangle that marks the current item
10201020 selectedRect . Position = new PointF ( pos . X , pos . Y + ( ( index - firstItem ) * itemHeight ) ) ;
10211021 // And then do the description background and text
1022- descriptionText . Text = Items . Count == 0 || SelectedIndex == - 1 ? NoItemsText : SelectedItem . Description ;
10231022 float description = pos . Y + ( ( Items . Count > maxItems ? maxItems : Items . Count ) * itemHeight ) + heightDiffDescImg ;
1024- int lineCount = descriptionText . LineCount ;
1025- descriptionRect . Size = new SizeF ( width , ( lineCount * ( descriptionText . LineHeight + 5 ) ) + ( lineCount - 1 ) + 10 ) ;
10261023 descriptionRect . Position = new PointF ( pos . X , description ) ;
10271024 descriptionText . Position = new PointF ( pos . X + posXDescTxt , description + heightDiffDescTxt ) ;
1025+ UpdateDescription ( ) ;
10281026
10291027 // Save the size of the items
10301028 SizeF size = new SizeF ( width , itemHeight ) ;
@@ -1043,6 +1041,15 @@ private void UpdateItems()
10431041 RecalculatePanel ( ) ;
10441042 }
10451043 /// <summary>
1044+ /// Updates the size and text of the description.
1045+ /// </summary>
1046+ private void UpdateDescription ( )
1047+ {
1048+ descriptionText . Text = Items . Count == 0 || SelectedIndex == - 1 ? NoItemsText : SelectedItem . Description ;
1049+ int lineCount = descriptionText . LineCount ;
1050+ descriptionRect . Size = new SizeF ( width , ( lineCount * ( descriptionText . LineHeight + 5 ) ) + ( lineCount - 1 ) + 10 ) ;
1051+ }
1052+ /// <summary>
10461053 /// Processes the button presses.
10471054 /// </summary>
10481055 private void ProcessControls ( )
@@ -1525,17 +1532,19 @@ public void Clear()
15251532 /// </summary>
15261533 public void Process ( )
15271534 {
1528- // If the menu is not visible, return
15291535 if ( ! visible )
15301536 {
15311537 return ;
15321538 }
15331539
1534- // Otherwise, draw the elements
1540+ NativeItem selected = SelectedItem ;
1541+ if ( selected != null && descriptionText . Text != selected . Description )
1542+ {
1543+ UpdateDescription ( ) ;
1544+ }
1545+
15351546 Draw ( ) ;
1536- // And then work on the controls
15371547 ProcessControls ( ) ;
1538- // And finish by drawing the instructional buttons
15391548 Buttons . Draw ( ) ;
15401549 }
15411550 /// <summary>
0 commit comments