From 1c2af21361d28ef346e5bbff1dec3c50c8bd5df4 Mon Sep 17 00:00:00 2001 From: Kurt Date: Sun, 10 May 2020 12:19:24 -0700 Subject: [PATCH] Show item sprite in item editor no markup of ancillary values, just the image --- NHSE.Core/Drawing/ItemColor.cs | 10 + NHSE.Sprites/Item/ItemSprite.cs | 4 + NHSE.WinForms/Controls/ItemEditor.Designer.cs | 302 +++++++++--------- NHSE.WinForms/Controls/ItemEditor.cs | 9 + 4 files changed, 182 insertions(+), 143 deletions(-) diff --git a/NHSE.Core/Drawing/ItemColor.cs b/NHSE.Core/Drawing/ItemColor.cs index 64dbcb2..3048884 100644 --- a/NHSE.Core/Drawing/ItemColor.cs +++ b/NHSE.Core/Drawing/ItemColor.cs @@ -13,5 +13,15 @@ public static Color GetItemColor(Item item) return Color.LimeGreen; return ColorUtil.Colors[(int)kind]; } + + public static Color GetItemColor(ushort item) + { + if (item == Item.NONE) + return Color.Transparent; + var kind = ItemInfo.GetItemKind(item); + if (kind == ItemKind.Unknown) + return Color.LimeGreen; + return ColorUtil.Colors[(int)kind]; + } } } diff --git a/NHSE.Sprites/Item/ItemSprite.cs b/NHSE.Sprites/Item/ItemSprite.cs index d521879..4c63f2a 100644 --- a/NHSE.Sprites/Item/ItemSprite.cs +++ b/NHSE.Sprites/Item/ItemSprite.cs @@ -37,7 +37,11 @@ public static Bitmap GetItemMarkup(Item item, Font font, int width, int height, public static Image? GetItemSprite(Item item) { var id = item.ItemId; + return GetItemSprite(id); + } + public static Image? GetItemSprite(ushort id) + { if (id == Item.NONE) return null; diff --git a/NHSE.WinForms/Controls/ItemEditor.Designer.cs b/NHSE.WinForms/Controls/ItemEditor.Designer.cs index f146475..d7f739a 100644 --- a/NHSE.WinForms/Controls/ItemEditor.Designer.cs +++ b/NHSE.WinForms/Controls/ItemEditor.Designer.cs @@ -44,13 +44,21 @@ private void InitializeComponent() this.Menu_Delete = new System.Windows.Forms.ToolStripMenuItem(); this.CB_Recipe = new System.Windows.Forms.ComboBox(); this.FLP_Controls = new System.Windows.Forms.FlowLayoutPanel(); - this.CB_Fossil = new System.Windows.Forms.ComboBox(); + this.CHK_IsExtension = new System.Windows.Forms.CheckBox(); + this.FLP_Extension = new System.Windows.Forms.FlowLayoutPanel(); + this.L_ExtensionX = new System.Windows.Forms.Label(); + this.NUD_ExtensionX = new System.Windows.Forms.NumericUpDown(); + this.L_ExtensionY = new System.Windows.Forms.Label(); + this.NUD_ExtensionY = new System.Windows.Forms.NumericUpDown(); + this.FLP_Item = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_Count = new System.Windows.Forms.FlowLayoutPanel(); this.L_RemakeBody = new System.Windows.Forms.Label(); this.L_RemakeFabric = new System.Windows.Forms.Label(); + this.CB_Fossil = new System.Windows.Forms.ComboBox(); this.FLP_Uses = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_Flag0 = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_Flag1 = new System.Windows.Forms.FlowLayoutPanel(); + this.FLP_Flower = new System.Windows.Forms.FlowLayoutPanel(); this.FLP_Genetics = new System.Windows.Forms.FlowLayoutPanel(); this.CHK_R2 = new System.Windows.Forms.CheckBox(); this.CHK_R1 = new System.Windows.Forms.CheckBox(); @@ -75,32 +83,26 @@ private void InitializeComponent() this.CHK_WV6 = new System.Windows.Forms.CheckBox(); this.CHK_WV9 = new System.Windows.Forms.CheckBox(); this.CHK_Gold = new System.Windows.Forms.CheckBox(); - this.FLP_Extension = new System.Windows.Forms.FlowLayoutPanel(); - this.NUD_ExtensionX = new System.Windows.Forms.NumericUpDown(); - this.L_ExtensionX = new System.Windows.Forms.Label(); - this.NUD_ExtensionY = new System.Windows.Forms.NumericUpDown(); - this.L_ExtensionY = new System.Windows.Forms.Label(); - this.CHK_IsExtension = new System.Windows.Forms.CheckBox(); - this.FLP_Item = new System.Windows.Forms.FlowLayoutPanel(); - this.FLP_Flower = new System.Windows.Forms.FlowLayoutPanel(); + this.PB_Item = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Count)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Uses)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Flag0)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Flag1)).BeginInit(); this.CM_Hand.SuspendLayout(); this.FLP_Controls.SuspendLayout(); - this.FLP_Count.SuspendLayout(); - this.FLP_Uses.SuspendLayout(); - this.FLP_Flag0.SuspendLayout(); - this.FLP_Flag1.SuspendLayout(); - this.FLP_Genetics.SuspendLayout(); - this.FLP_FlowerFlags.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_WaterDays)).BeginInit(); this.FLP_Extension.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ExtensionX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_ExtensionY)).BeginInit(); this.FLP_Item.SuspendLayout(); + this.FLP_Count.SuspendLayout(); + this.FLP_Uses.SuspendLayout(); + this.FLP_Flag0.SuspendLayout(); + this.FLP_Flag1.SuspendLayout(); this.FLP_Flower.SuspendLayout(); + this.FLP_Genetics.SuspendLayout(); + this.FLP_FlowerFlags.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_WaterDays)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.PB_Item)).BeginInit(); this.SuspendLayout(); // // CB_ItemID @@ -109,7 +111,7 @@ private void InitializeComponent() this.CB_ItemID.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; this.CB_ItemID.DropDownWidth = 322; this.CB_ItemID.FormattingEnabled = true; - this.CB_ItemID.Location = new System.Drawing.Point(3, 1); + this.CB_ItemID.Location = new System.Drawing.Point(3, 73); this.CB_ItemID.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1); this.CB_ItemID.Name = "CB_ItemID"; this.CB_ItemID.Size = new System.Drawing.Size(141, 21); @@ -256,6 +258,7 @@ private void InitializeComponent() // FLP_Controls // this.FLP_Controls.AutoSize = true; + this.FLP_Controls.Controls.Add(this.PB_Item); this.FLP_Controls.Controls.Add(this.CB_ItemID); this.FLP_Controls.Controls.Add(this.CHK_IsExtension); this.FLP_Controls.Controls.Add(this.FLP_Extension); @@ -264,23 +267,102 @@ private void InitializeComponent() this.FLP_Controls.Location = new System.Drawing.Point(0, 0); this.FLP_Controls.Margin = new System.Windows.Forms.Padding(0); this.FLP_Controls.Name = "FLP_Controls"; - this.FLP_Controls.Size = new System.Drawing.Size(211, 517); + this.FLP_Controls.Size = new System.Drawing.Size(211, 548); this.FLP_Controls.TabIndex = 15; // - // CB_Fossil + // CHK_IsExtension // - this.CB_Fossil.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; - this.CB_Fossil.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; - this.CB_Fossil.DropDownWidth = 322; - this.CB_Fossil.FormattingEnabled = true; - this.CB_Fossil.Location = new System.Drawing.Point(3, 24); - this.CB_Fossil.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1); - this.CB_Fossil.Name = "CB_Fossil"; - this.CB_Fossil.Size = new System.Drawing.Size(141, 21); - this.CB_Fossil.TabIndex = 21; - this.CB_Fossil.Visible = false; - this.CB_Fossil.SelectedValueChanged += new System.EventHandler(this.CB_CountAlias_SelectedValueChanged); - this.CB_Fossil.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CB_KeyDown); + this.CHK_IsExtension.AutoSize = true; + this.FLP_Controls.SetFlowBreak(this.CHK_IsExtension, true); + this.CHK_IsExtension.Location = new System.Drawing.Point(17, 98); + this.CHK_IsExtension.Margin = new System.Windows.Forms.Padding(17, 3, 3, 3); + this.CHK_IsExtension.Name = "CHK_IsExtension"; + this.CHK_IsExtension.Size = new System.Drawing.Size(72, 17); + this.CHK_IsExtension.TabIndex = 27; + this.CHK_IsExtension.Text = "Extension"; + this.CHK_IsExtension.UseVisualStyleBackColor = true; + this.CHK_IsExtension.CheckedChanged += new System.EventHandler(this.CHK_IsExtension_CheckedChanged); + // + // FLP_Extension + // + this.FLP_Extension.AutoSize = true; + this.FLP_Extension.Controls.Add(this.L_ExtensionX); + this.FLP_Extension.Controls.Add(this.NUD_ExtensionX); + this.FLP_Extension.Controls.Add(this.L_ExtensionY); + this.FLP_Extension.Controls.Add(this.NUD_ExtensionY); + this.FLP_Extension.Location = new System.Drawing.Point(0, 135); + this.FLP_Extension.Margin = new System.Windows.Forms.Padding(0); + this.FLP_Extension.Name = "FLP_Extension"; + this.FLP_Extension.Size = new System.Drawing.Size(88, 40); + this.FLP_Extension.TabIndex = 24; + this.FLP_Extension.Visible = false; + // + // L_ExtensionX + // + this.L_ExtensionX.AutoSize = true; + this.L_ExtensionX.Location = new System.Drawing.Point(33, 3); + this.L_ExtensionX.Margin = new System.Windows.Forms.Padding(33, 3, 3, 3); + this.L_ExtensionX.Name = "L_ExtensionX"; + this.L_ExtensionX.Size = new System.Drawing.Size(17, 13); + this.L_ExtensionX.TabIndex = 8; + this.L_ExtensionX.Text = "X:"; + // + // NUD_ExtensionX + // + this.FLP_Extension.SetFlowBreak(this.NUD_ExtensionX, true); + this.NUD_ExtensionX.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.NUD_ExtensionX.Location = new System.Drawing.Point(53, 0); + this.NUD_ExtensionX.Margin = new System.Windows.Forms.Padding(0); + this.NUD_ExtensionX.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_ExtensionX.Name = "NUD_ExtensionX"; + this.NUD_ExtensionX.Size = new System.Drawing.Size(35, 20); + this.NUD_ExtensionX.TabIndex = 7; + // + // L_ExtensionY + // + this.L_ExtensionY.AutoSize = true; + this.L_ExtensionY.Location = new System.Drawing.Point(33, 23); + this.L_ExtensionY.Margin = new System.Windows.Forms.Padding(33, 3, 3, 3); + this.L_ExtensionY.Name = "L_ExtensionY"; + this.L_ExtensionY.Size = new System.Drawing.Size(17, 13); + this.L_ExtensionY.TabIndex = 26; + this.L_ExtensionY.Text = "Y:"; + // + // NUD_ExtensionY + // + this.NUD_ExtensionY.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); + this.NUD_ExtensionY.Location = new System.Drawing.Point(53, 20); + this.NUD_ExtensionY.Margin = new System.Windows.Forms.Padding(0); + this.NUD_ExtensionY.Maximum = new decimal(new int[] { + 255, + 0, + 0, + 0}); + this.NUD_ExtensionY.Name = "NUD_ExtensionY"; + this.NUD_ExtensionY.Size = new System.Drawing.Size(35, 20); + this.NUD_ExtensionY.TabIndex = 25; + // + // FLP_Item + // + this.FLP_Item.AutoSize = true; + this.FLP_Item.Controls.Add(this.CB_Recipe); + this.FLP_Item.Controls.Add(this.CB_Fossil); + this.FLP_Item.Controls.Add(this.FLP_Count); + this.FLP_Item.Controls.Add(this.L_RemakeBody); + this.FLP_Item.Controls.Add(this.L_RemakeFabric); + this.FLP_Item.Controls.Add(this.FLP_Uses); + this.FLP_Item.Controls.Add(this.FLP_Flag0); + this.FLP_Item.Controls.Add(this.FLP_Flag1); + this.FLP_Item.Controls.Add(this.FLP_Flower); + this.FLP_Item.Location = new System.Drawing.Point(0, 175); + this.FLP_Item.Margin = new System.Windows.Forms.Padding(0); + this.FLP_Item.Name = "FLP_Item"; + this.FLP_Item.Size = new System.Drawing.Size(167, 370); + this.FLP_Item.TabIndex = 25; // // FLP_Count // @@ -318,6 +400,21 @@ private void InitializeComponent() this.L_RemakeFabric.Text = "*RemakeFabric"; this.L_RemakeFabric.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // CB_Fossil + // + this.CB_Fossil.AutoCompleteMode = System.Windows.Forms.AutoCompleteMode.SuggestAppend; + this.CB_Fossil.AutoCompleteSource = System.Windows.Forms.AutoCompleteSource.ListItems; + this.CB_Fossil.DropDownWidth = 322; + this.CB_Fossil.FormattingEnabled = true; + this.CB_Fossil.Location = new System.Drawing.Point(3, 24); + this.CB_Fossil.Margin = new System.Windows.Forms.Padding(3, 1, 3, 1); + this.CB_Fossil.Name = "CB_Fossil"; + this.CB_Fossil.Size = new System.Drawing.Size(141, 21); + this.CB_Fossil.TabIndex = 21; + this.CB_Fossil.Visible = false; + this.CB_Fossil.SelectedValueChanged += new System.EventHandler(this.CB_CountAlias_SelectedValueChanged); + this.CB_Fossil.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CB_KeyDown); + // // FLP_Uses // this.FLP_Uses.Controls.Add(this.NUD_Uses); @@ -351,6 +448,18 @@ private void InitializeComponent() this.FLP_Flag1.Size = new System.Drawing.Size(147, 26); this.FLP_Flag1.TabIndex = 17; // + // FLP_Flower + // + this.FLP_Flower.AutoSize = true; + this.FLP_Flower.Controls.Add(this.FLP_Genetics); + this.FLP_Flower.Controls.Add(this.FLP_FlowerFlags); + this.FLP_Flower.Location = new System.Drawing.Point(0, 200); + this.FLP_Flower.Margin = new System.Windows.Forms.Padding(0); + this.FLP_Flower.Name = "FLP_Flower"; + this.FLP_Flower.Size = new System.Drawing.Size(147, 170); + this.FLP_Flower.TabIndex = 24; + this.FLP_Flower.Visible = false; + // // FLP_Genetics // this.FLP_Genetics.Controls.Add(this.CHK_R2); @@ -681,111 +790,16 @@ private void InitializeComponent() this.CHK_Gold.TextAlign = System.Drawing.ContentAlignment.MiddleRight; this.CHK_Gold.UseVisualStyleBackColor = true; // - // FLP_Extension + // PB_Item // - this.FLP_Extension.AutoSize = true; - this.FLP_Extension.Controls.Add(this.L_ExtensionX); - this.FLP_Extension.Controls.Add(this.NUD_ExtensionX); - this.FLP_Extension.Controls.Add(this.L_ExtensionY); - this.FLP_Extension.Controls.Add(this.NUD_ExtensionY); - this.FLP_Extension.Location = new System.Drawing.Point(0, 63); - this.FLP_Extension.Margin = new System.Windows.Forms.Padding(0); - this.FLP_Extension.Name = "FLP_Extension"; - this.FLP_Extension.Size = new System.Drawing.Size(88, 40); - this.FLP_Extension.TabIndex = 24; - this.FLP_Extension.Visible = false; - // - // NUD_ExtensionX - // - this.FLP_Extension.SetFlowBreak(this.NUD_ExtensionX, true); - this.NUD_ExtensionX.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.NUD_ExtensionX.Location = new System.Drawing.Point(53, 0); - this.NUD_ExtensionX.Margin = new System.Windows.Forms.Padding(0); - this.NUD_ExtensionX.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_ExtensionX.Name = "NUD_ExtensionX"; - this.NUD_ExtensionX.Size = new System.Drawing.Size(35, 20); - this.NUD_ExtensionX.TabIndex = 7; - // - // L_ExtensionX - // - this.L_ExtensionX.AutoSize = true; - this.L_ExtensionX.Location = new System.Drawing.Point(33, 3); - this.L_ExtensionX.Margin = new System.Windows.Forms.Padding(33, 3, 3, 3); - this.L_ExtensionX.Name = "L_ExtensionX"; - this.L_ExtensionX.Size = new System.Drawing.Size(17, 13); - this.L_ExtensionX.TabIndex = 8; - this.L_ExtensionX.Text = "X:"; - // - // NUD_ExtensionY - // - this.NUD_ExtensionY.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.NUD_ExtensionY.Location = new System.Drawing.Point(53, 20); - this.NUD_ExtensionY.Margin = new System.Windows.Forms.Padding(0); - this.NUD_ExtensionY.Maximum = new decimal(new int[] { - 255, - 0, - 0, - 0}); - this.NUD_ExtensionY.Name = "NUD_ExtensionY"; - this.NUD_ExtensionY.Size = new System.Drawing.Size(35, 20); - this.NUD_ExtensionY.TabIndex = 25; - // - // L_ExtensionY - // - this.L_ExtensionY.AutoSize = true; - this.L_ExtensionY.Location = new System.Drawing.Point(33, 23); - this.L_ExtensionY.Margin = new System.Windows.Forms.Padding(33, 3, 3, 3); - this.L_ExtensionY.Name = "L_ExtensionY"; - this.L_ExtensionY.Size = new System.Drawing.Size(17, 13); - this.L_ExtensionY.TabIndex = 26; - this.L_ExtensionY.Text = "Y:"; - // - // CHK_IsExtension - // - this.CHK_IsExtension.AutoSize = true; - this.FLP_Controls.SetFlowBreak(this.CHK_IsExtension, true); - this.CHK_IsExtension.Location = new System.Drawing.Point(17, 26); - this.CHK_IsExtension.Margin = new System.Windows.Forms.Padding(17, 3, 3, 3); - this.CHK_IsExtension.Name = "CHK_IsExtension"; - this.CHK_IsExtension.Size = new System.Drawing.Size(72, 17); - this.CHK_IsExtension.TabIndex = 27; - this.CHK_IsExtension.Text = "Extension"; - this.CHK_IsExtension.UseVisualStyleBackColor = true; - this.CHK_IsExtension.CheckedChanged += new System.EventHandler(this.CHK_IsExtension_CheckedChanged); - // - // FLP_Item - // - this.FLP_Item.AutoSize = true; - this.FLP_Item.Controls.Add(this.CB_Recipe); - this.FLP_Item.Controls.Add(this.CB_Fossil); - this.FLP_Item.Controls.Add(this.FLP_Count); - this.FLP_Item.Controls.Add(this.L_RemakeBody); - this.FLP_Item.Controls.Add(this.L_RemakeFabric); - this.FLP_Item.Controls.Add(this.FLP_Uses); - this.FLP_Item.Controls.Add(this.FLP_Flag0); - this.FLP_Item.Controls.Add(this.FLP_Flag1); - this.FLP_Item.Controls.Add(this.FLP_Flower); - this.FLP_Item.Location = new System.Drawing.Point(0, 103); - this.FLP_Item.Margin = new System.Windows.Forms.Padding(0); - this.FLP_Item.Name = "FLP_Item"; - this.FLP_Item.Size = new System.Drawing.Size(167, 370); - this.FLP_Item.TabIndex = 25; - // - // FLP_Flower - // - this.FLP_Flower.AutoSize = true; - this.FLP_Flower.Controls.Add(this.FLP_Genetics); - this.FLP_Flower.Controls.Add(this.FLP_FlowerFlags); - this.FLP_Flower.Location = new System.Drawing.Point(0, 200); - this.FLP_Flower.Margin = new System.Windows.Forms.Padding(0); - this.FLP_Flower.Name = "FLP_Flower"; - this.FLP_Flower.Size = new System.Drawing.Size(147, 170); - this.FLP_Flower.TabIndex = 24; - this.FLP_Flower.Visible = false; + this.PB_Item.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.PB_Item.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.PB_Item.Location = new System.Drawing.Point(3, 3); + this.PB_Item.Name = "PB_Item"; + this.PB_Item.Size = new System.Drawing.Size(66, 66); + this.PB_Item.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.PB_Item.TabIndex = 28; + this.PB_Item.TabStop = false; // // ItemEditor // @@ -793,7 +807,7 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.FLP_Controls); this.Name = "ItemEditor"; - this.Size = new System.Drawing.Size(211, 517); + this.Size = new System.Drawing.Size(211, 548); ((System.ComponentModel.ISupportInitialize)(this.NUD_Count)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Uses)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.NUD_Flag0)).EndInit(); @@ -801,6 +815,12 @@ private void InitializeComponent() this.CM_Hand.ResumeLayout(false); this.FLP_Controls.ResumeLayout(false); this.FLP_Controls.PerformLayout(); + this.FLP_Extension.ResumeLayout(false); + this.FLP_Extension.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ExtensionX)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.NUD_ExtensionY)).EndInit(); + this.FLP_Item.ResumeLayout(false); + this.FLP_Item.PerformLayout(); this.FLP_Count.ResumeLayout(false); this.FLP_Count.PerformLayout(); this.FLP_Uses.ResumeLayout(false); @@ -809,17 +829,12 @@ private void InitializeComponent() this.FLP_Flag0.PerformLayout(); this.FLP_Flag1.ResumeLayout(false); this.FLP_Flag1.PerformLayout(); + this.FLP_Flower.ResumeLayout(false); this.FLP_Genetics.ResumeLayout(false); this.FLP_FlowerFlags.ResumeLayout(false); this.FLP_FlowerFlags.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.NUD_WaterDays)).EndInit(); - this.FLP_Extension.ResumeLayout(false); - this.FLP_Extension.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ExtensionX)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.NUD_ExtensionY)).EndInit(); - this.FLP_Item.ResumeLayout(false); - this.FLP_Item.PerformLayout(); - this.FLP_Flower.ResumeLayout(false); + ((System.ComponentModel.ISupportInitialize)(this.PB_Item)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -880,5 +895,6 @@ private void InitializeComponent() private System.Windows.Forms.NumericUpDown NUD_ExtensionY; private System.Windows.Forms.FlowLayoutPanel FLP_Item; private System.Windows.Forms.FlowLayoutPanel FLP_Flower; + private System.Windows.Forms.PictureBox PB_Item; } } diff --git a/NHSE.WinForms/Controls/ItemEditor.cs b/NHSE.WinForms/Controls/ItemEditor.cs index 410c3c4..42567ae 100644 --- a/NHSE.WinForms/Controls/ItemEditor.cs +++ b/NHSE.WinForms/Controls/ItemEditor.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Windows.Forms; using NHSE.Core; +using NHSE.Sprites; namespace NHSE.WinForms { @@ -131,6 +132,7 @@ private Item SetExtensionItem(Item item) private void CB_ItemID_SelectedValueChanged(object sender, EventArgs e) { var itemID = (ushort)WinFormsUtil.GetIndex(CB_ItemID); + ChangeItem(itemID); var kind = ItemInfo.GetItemKind(itemID); ToggleEditorVisibility(kind); @@ -266,5 +268,12 @@ private void CHK_IsExtension_CheckedChanged(object sender, EventArgs e) FLP_Extension.Visible = false; } } + + private void ChangeItem(ushort item) + { + var pb = PB_Item; + pb.BackColor = ItemColor.GetItemColor(item); + pb.BackgroundImage = ItemSprite.GetItemSprite(item); + } } }