@@ -86,11 +86,14 @@ public class TrainCarOperationsViewerWindow : Window
8686 public int RowsCount ;
8787 public int SpacerRowCount ;
8888 public int SymbolsRowCount ;
89+ public int CurrentNewWidth ;
8990 public bool BrakeHoseCarCoupling ;
9091
9192 const int SymbolWidth = 32 ;
9293 public static bool FontChanged ;
9394 public static bool FontToBold ;
95+ public int DisplaySizeY ;
96+ public bool DisplayReSized = false ;
9497 public int WindowHeightMin ;
9598 public int WindowHeightMax ;
9699 public int WindowWidthMin ;
@@ -307,6 +310,7 @@ private void ModifyWindowSize()
307310 {
308311 if ( SymbolsRowCount > 0 )
309312 {
313+ DisplaySizeY = Owner . Viewer . DisplaySize . Y ;
310314 var desiredHeight = FontToBold ? Owner . TextFontDefaultBold . Height * RowsCount
311315 : ( Owner . TextFontDefault . Height * RowsCount ) + SymbolWidth ;
312316 var desiredWidth = ( SymbolsRowCount * SymbolWidth ) + ( SpacerRowCount * ( SymbolWidth / 2 ) ) + ( LocoRowCount * ( SymbolWidth * 2 ) ) ;
@@ -321,10 +325,12 @@ private void ModifyWindowSize()
321325 SizeTo ( newWidth , newHeight ) ;
322326 var locationX = Location . X ;
323327 var locationY = newTop ;
324- if ( Owner . Viewer . TrainCarOperationsWindow . LayoutMoved )
328+ if ( Owner . Viewer . TrainCarOperationsWindow . LayoutMoved || newWidth != CurrentNewWidth || DisplayReSized )
325329 {
326330 CkeckCollision ( newWidth , newHeight , ref locationX , ref locationY ) ;
327331 Owner . Viewer . TrainCarOperationsWindow . LayoutMoved = false ;
332+ CurrentNewWidth = newWidth ;
333+ DisplayReSized = false ;
328334 }
329335 MoveTo ( locationX , locationY ) ;
330336 }
@@ -484,6 +490,12 @@ public override void PrepareFrame(ElapsedTime elapsedTime, bool updateFull)
484490 UpdateWindowSize ( ) ;
485491 }
486492
493+ if ( DisplaySizeY != Owner . Viewer . DisplaySize . Y )
494+ {
495+ DisplayReSized = true ;
496+ UpdateWindowSize ( ) ;
497+ }
498+
487499 TrainCar trainCar = Owner . Viewer . PlayerTrain . Cars [ CarPosition ] ;
488500 bool isElectricDieselLocomotive = ( trainCar is MSTSElectricLocomotive ) || ( trainCar is MSTSDieselLocomotive ) ;
489501
0 commit comments