From 8d7f56a7db705278c15501f59aa7a6d6ed063f7d Mon Sep 17 00:00:00 2001 From: Kurt Date: Thu, 5 Aug 2021 18:54:47 -0700 Subject: [PATCH] Remove box bar, inline sprite height calc Skip empty slots since the input data no longer guarantees no empty slots --- PKHeX.WinForms/Subforms/ReportGrid.Designer.cs | 14 ++------------ PKHeX.WinForms/Subforms/ReportGrid.cs | 17 +++++++++-------- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/PKHeX.WinForms/Subforms/ReportGrid.Designer.cs b/PKHeX.WinForms/Subforms/ReportGrid.Designer.cs index a1173362d..e0528b131 100644 --- a/PKHeX.WinForms/Subforms/ReportGrid.Designer.cs +++ b/PKHeX.WinForms/Subforms/ReportGrid.Designer.cs @@ -30,7 +30,6 @@ { System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); this.dgData = new System.Windows.Forms.DataGridView(); - this.BoxBar = new System.Windows.Forms.ProgressBar(); ((System.ComponentModel.ISupportInitialize)(this.dgData)).BeginInit(); this.SuspendLayout(); // @@ -38,7 +37,7 @@ // this.dgData.AllowUserToAddRows = false; this.dgData.AllowUserToDeleteRows = false; - dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(224, 224, 224); + dataGridViewCellStyle1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(224)))), ((int)(((byte)(224)))), ((int)(((byte)(224))))); this.dgData.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1; this.dgData.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.EnableAlwaysIncludeHeaderText; this.dgData.Dock = System.Windows.Forms.DockStyle.Fill; @@ -49,19 +48,11 @@ this.dgData.TabIndex = 0; this.dgData.Sorted += new System.EventHandler(this.Data_Sorted); // - // BoxBar - // - this.BoxBar.Location = new System.Drawing.Point(13, 13); - this.BoxBar.Name = "BoxBar"; - this.BoxBar.Size = new System.Drawing.Size(787, 23); - this.BoxBar.TabIndex = 1; - // - // frmReport + // ReportGrid // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(812, 461); - this.Controls.Add(this.BoxBar); this.Controls.Add(this.dgData); this.Icon = global::PKHeX.WinForms.Properties.Resources.Icon; this.Name = "ReportGrid"; @@ -76,6 +67,5 @@ #endregion private System.Windows.Forms.DataGridView dgData; - private System.Windows.Forms.ProgressBar BoxBar; } } \ No newline at end of file diff --git a/PKHeX.WinForms/Subforms/ReportGrid.cs b/PKHeX.WinForms/Subforms/ReportGrid.cs index 2b5594ff7..48c9e7fcc 100644 --- a/PKHeX.WinForms/Subforms/ReportGrid.cs +++ b/PKHeX.WinForms/Subforms/ReportGrid.cs @@ -54,27 +54,28 @@ namespace PKHeX.WinForms public void PopulateData(IList Data) { SuspendLayout(); - BoxBar.Step = 1; var PL = new PokemonList(); var strings = GameInfo.Strings; foreach (var entry in Data) { var pkm = entry.Entity; + if ((uint)(pkm.Species - 1) >= pkm.MaxSpeciesID) + { + continue; + } pkm.Stat_Level = pkm.CurrentLevel; // recalc Level PL.Add(new EntitySummaryImage(pkm, strings, entry.Identify())); - BoxBar.PerformStep(); } dgData.DataSource = PL; dgData.AutoGenerateColumns = true; - BoxBar.Maximum = Data.Count + dgData.Columns.Count; for (int i = 0; i < dgData.Columns.Count; i++) { - BoxBar.PerformStep(); - if (dgData.Columns[i] is DataGridViewImageColumn) continue; // Don't add sorting for Sprites - dgData.Columns[i].SortMode = DataGridViewColumnSortMode.Automatic; + var col = dgData.Columns[i]; + if (col is DataGridViewImageColumn) + continue; // Don't add sorting for Sprites + col.SortMode = DataGridViewColumnSortMode.Automatic; } - BoxBar.Visible = false; // Trigger Resizing dgData.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; @@ -92,7 +93,7 @@ namespace PKHeX.WinForms private void Data_Sorted(object sender, EventArgs e) { - int height = SpriteUtil.GetSprite(1, 0, 0, 0, 0, false, false).Height + 1; // dummy sprite, max height of a row + int height = SpriteUtil.Spriter.Height + 1; // max height of a row, +1px for (int i = 0; i < dgData.Rows.Count; i++) dgData.Rows[i].Height = height; }