Remove box bar, inline sprite height calc

Skip empty slots since the input data no longer guarantees no empty slots
This commit is contained in:
Kurt 2021-08-05 18:54:47 -07:00
parent edcf3a9bd6
commit 8d7f56a7db
2 changed files with 11 additions and 20 deletions

View file

@ -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;
}
}

View file

@ -54,27 +54,28 @@ namespace PKHeX.WinForms
public void PopulateData(IList<SlotCache> Data)
{
SuspendLayout();
BoxBar.Step = 1;
var PL = new PokemonList<EntitySummaryImage>();
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;
}