private void LoadList(string Filename) { Properties.Settings.Default.LastList = Filename; panelBossList.Controls.Clear(); try { XmlSerializer xml = new XmlSerializer(typeof(SBossList)); using (FileStream fs = File.OpenRead(Filename)) mBossList = xml.Deserialize(fs) as SBossList; } catch (Exception e) { System.Diagnostics.Debug.WriteLine(e); } int perRow = int.Parse(Properties.Settings.Default.TimerPerRow); int pad = 10; int column = 0, row = 0, maxRow = 0; int panelWidth = 0; for (int i = 0; i < mBossList.Count; i++) { if ((i - (column * perRow)) == perRow) { column++; row = 0; } BossPanel p = new BossPanel(mBossList[i], int.Parse(Properties.Settings.Default.TimerWidth)); p.Location = new Point(10 + (column * (p.Width + 10)), (p.Height * row) + (pad * row)); panelWidth = p.Width; panelBossList.Controls.Add(p); maxRow = Math.Max(maxRow, ++row); } // set Window Height column++; Size = new Size(15 + (column * (panelWidth + 10)), 90 + (maxRow * (30 + pad))); }
private void LoadList( string Filename ) { Properties.Settings.Default.LastList = Filename; panelBossList.Controls.Clear(); try { XmlSerializer xml = new XmlSerializer( typeof( SBossList ) ); using( FileStream fs = File.OpenRead( Filename ) ) mBossList = xml.Deserialize( fs ) as SBossList; } catch( Exception e ) { System.Diagnostics.Debug.WriteLine( e ); } int perRow = int.Parse( Properties.Settings.Default.TimerPerRow ); int pad = 10; int column = 0, row = 0, maxRow = 0; int panelWidth = 0; for( int i = 0; i < mBossList.Count; i++ ) { if( ( i - ( column * perRow ) ) == perRow ) { column++; row = 0; } BossPanel p = new BossPanel( mBossList[ i ], int.Parse( Properties.Settings.Default.TimerWidth ) ); p.Location = new Point( 10 + ( column * ( p.Width + 10 ) ), ( p.Height * row ) + ( pad * row ) ); panelWidth = p.Width; panelBossList.Controls.Add( p ); maxRow = Math.Max( maxRow, ++row ); } // set Window Height column++; Size = new Size( 15 + ( column * ( panelWidth + 10 ) ), 90 + ( maxRow * ( 30 + pad ) ) ); }