Bigger & Resizable texture selector with Enter key detection (#688)

This commit is contained in:
MelonSpeedruns 2023-12-01 18:02:01 -05:00 committed by GitHub
parent efe975c48e
commit 4faac49066
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 79 additions and 45 deletions

View file

@ -43,6 +43,7 @@
//
// contentContainer
//
this.contentContainer.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
this.contentContainer.Controls.Add(this.btnEdit);
this.contentContainer.Controls.Add(this.btnAdd);
this.contentContainer.Controls.Add(this.pictureBoxCustom1);
@ -50,6 +51,9 @@
this.contentContainer.Controls.Add(this.btnOk);
this.contentContainer.Controls.Add(this.stLabel1);
this.contentContainer.Controls.Add(this.stTextBox1);
this.contentContainer.Dock = System.Windows.Forms.DockStyle.Fill;
this.contentContainer.Location = new System.Drawing.Point(0, 0);
this.contentContainer.Size = new System.Drawing.Size(1280, 720);
this.contentContainer.Controls.SetChildIndex(this.stTextBox1, 0);
this.contentContainer.Controls.SetChildIndex(this.stLabel1, 0);
this.contentContainer.Controls.SetChildIndex(this.btnOk, 0);
@ -63,7 +67,7 @@
this.stTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.stTextBox1.Location = new System.Drawing.Point(56, 31);
this.stTextBox1.Name = "stTextBox1";
this.stTextBox1.Size = new System.Drawing.Size(163, 20);
this.stTextBox1.Size = new System.Drawing.Size(583, 20);
this.stTextBox1.TabIndex = 0;
//
// stLabel1
@ -80,7 +84,7 @@
this.btnOk.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOk.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOk.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnOk.Location = new System.Drawing.Point(459, 361);
this.btnOk.Location = new System.Drawing.Point(1196, 688);
this.btnOk.Name = "btnOk";
this.btnOk.Size = new System.Drawing.Size(75, 23);
this.btnOk.TabIndex = 2;
@ -93,10 +97,11 @@
this.listViewCustom1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listViewCustom1.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.listViewCustom1.HideSelection = false;
this.listViewCustom1.Location = new System.Drawing.Point(9, 57);
this.listViewCustom1.Name = "listViewCustom1";
this.listViewCustom1.OwnerDraw = true;
this.listViewCustom1.Size = new System.Drawing.Size(210, 298);
this.listViewCustom1.Size = new System.Drawing.Size(630, 649);
this.listViewCustom1.TabIndex = 11;
this.listViewCustom1.UseCompatibleStateImageBehavior = false;
this.listViewCustom1.View = System.Windows.Forms.View.Details;
@ -110,9 +115,9 @@
//
this.pictureBoxCustom1.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxCustom1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom1.BackgroundImage")));
this.pictureBoxCustom1.Location = new System.Drawing.Point(225, 57);
this.pictureBoxCustom1.Location = new System.Drawing.Point(645, 57);
this.pictureBoxCustom1.Name = "pictureBoxCustom1";
this.pictureBoxCustom1.Size = new System.Drawing.Size(309, 298);
this.pictureBoxCustom1.Size = new System.Drawing.Size(620, 620);
this.pictureBoxCustom1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxCustom1.TabIndex = 12;
this.pictureBoxCustom1.TabStop = false;
@ -121,7 +126,7 @@
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnAdd.Location = new System.Drawing.Point(9, 361);
this.btnAdd.Location = new System.Drawing.Point(651, 688);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(75, 23);
this.btnAdd.TabIndex = 13;
@ -133,7 +138,7 @@
//
this.btnEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnEdit.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.btnEdit.Location = new System.Drawing.Point(90, 361);
this.btnEdit.Location = new System.Drawing.Point(732, 688);
this.btnEdit.Name = "btnEdit";
this.btnEdit.Size = new System.Drawing.Size(75, 23);
this.btnEdit.TabIndex = 14;
@ -145,7 +150,7 @@
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(549, 398);
this.ClientSize = new System.Drawing.Size(1280, 720);
this.Name = "Texture_Selector";
this.Text = "Texture_Selector";
this.contentContainer.ResumeLayout(false);

View file

@ -134,7 +134,7 @@
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACDTbOhAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRF
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACDTbOhAAAACXBIWXMAAA7CAAAOwgEVKEqAAAAAGXRF
WHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjIx8SBplQAAK8tJREFUeF7t3Qlz21iSBGDZOnifAEiABHif
Ou2e///ftu3OrBILitBMrzzjtvOLaHcHkqsCHnMghfdRuIqyp39d+JIgoM4eCXzdIjCrr4jg3EZAySMS
eMoR0HV4wb9WN0hoGWYc+wioi4D+yBDQzRkJLRtI4DpHQI8dJNT9goTSz0igtUFAu3Adn+KMf4WTuBqF

View file

@ -32,22 +32,24 @@
this.pictureBoxCustom1 = new Toolbox.Library.Forms.PictureBoxCustom();
this.listView1 = new System.Windows.Forms.ListView();
this.columnHeader1 = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
this.label1 = new System.Windows.Forms.Label();
this.addTextureBtn = new System.Windows.Forms.Button();
this.RemoveTextureBtn = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.stTextBox1 = new Toolbox.Library.Forms.STTextBox();
this.stLabel1 = new Toolbox.Library.Forms.STLabel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom1)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
//
// pictureBoxCustom1
//
this.pictureBoxCustom1.BackColor = System.Drawing.Color.Empty;
this.pictureBoxCustom1.BackColor = System.Drawing.Color.Transparent;
this.pictureBoxCustom1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("pictureBoxCustom1.BackgroundImage")));
this.pictureBoxCustom1.Location = new System.Drawing.Point(252, 25);
this.pictureBoxCustom1.Dock = System.Windows.Forms.DockStyle.Fill;
this.pictureBoxCustom1.Location = new System.Drawing.Point(623, 3);
this.pictureBoxCustom1.Name = "pictureBoxCustom1";
this.pictureBoxCustom1.Size = new System.Drawing.Size(408, 350);
this.pictureBoxCustom1.Size = new System.Drawing.Size(614, 583);
this.pictureBoxCustom1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
this.pictureBoxCustom1.TabIndex = 0;
this.pictureBoxCustom1.TabStop = false;
@ -58,12 +60,14 @@
this.listView1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.columnHeader1});
this.listView1.Dock = System.Windows.Forms.DockStyle.Fill;
this.listView1.ForeColor = System.Drawing.Color.White;
this.listView1.FullRowSelect = true;
this.listView1.Location = new System.Drawing.Point(5, 79);
this.listView1.HideSelection = false;
this.listView1.Location = new System.Drawing.Point(3, 3);
this.listView1.Name = "listView1";
this.listView1.OwnerDraw = true;
this.listView1.Size = new System.Drawing.Size(242, 296);
this.listView1.Size = new System.Drawing.Size(614, 583);
this.listView1.TabIndex = 1;
this.listView1.UseCompatibleStateImageBehavior = false;
this.listView1.View = System.Windows.Forms.View.Details;
@ -71,27 +75,19 @@
this.listView1.DrawItem += new System.Windows.Forms.DrawListViewItemEventHandler(this.listView1_DrawItem);
this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged);
this.listView1.DoubleClick += new System.EventHandler(this.listView1_DoubleClick);
this.listView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listView1_KeyDown);
//
// columnHeader1
//
this.columnHeader1.Text = "Texture";
this.columnHeader1.Width = 235;
//
// label1
//
this.label1.AutoSize = true;
this.label1.ForeColor = System.Drawing.Color.White;
this.label1.Location = new System.Drawing.Point(249, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(45, 13);
this.label1.TabIndex = 2;
this.label1.Text = "Preview";
this.columnHeader1.Width = 400;
//
// addTextureBtn
//
this.addTextureBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.addTextureBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.addTextureBtn.ForeColor = System.Drawing.Color.White;
this.addTextureBtn.Location = new System.Drawing.Point(4, 381);
this.addTextureBtn.Location = new System.Drawing.Point(12, 646);
this.addTextureBtn.Name = "addTextureBtn";
this.addTextureBtn.Size = new System.Drawing.Size(75, 23);
this.addTextureBtn.TabIndex = 3;
@ -101,9 +97,10 @@
//
// RemoveTextureBtn
//
this.RemoveTextureBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.RemoveTextureBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.RemoveTextureBtn.ForeColor = System.Drawing.Color.White;
this.RemoveTextureBtn.Location = new System.Drawing.Point(171, 381);
this.RemoveTextureBtn.Location = new System.Drawing.Point(93, 646);
this.RemoveTextureBtn.Name = "RemoveTextureBtn";
this.RemoveTextureBtn.Size = new System.Drawing.Size(75, 23);
this.RemoveTextureBtn.TabIndex = 4;
@ -113,12 +110,13 @@
//
// button3
//
this.button3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.button3.DialogResult = System.Windows.Forms.DialogResult.OK;
this.button3.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.button3.ForeColor = System.Drawing.Color.White;
this.button3.Location = new System.Drawing.Point(563, 381);
this.button3.Location = new System.Drawing.Point(1113, 646);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(75, 23);
this.button3.Size = new System.Drawing.Size(139, 23);
this.button3.TabIndex = 5;
this.button3.Text = "Save";
this.button3.UseVisualStyleBackColor = true;
@ -126,39 +124,55 @@
// stTextBox1
//
this.stTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.stTextBox1.Location = new System.Drawing.Point(5, 25);
this.stTextBox1.Location = new System.Drawing.Point(15, 25);
this.stTextBox1.Name = "stTextBox1";
this.stTextBox1.Size = new System.Drawing.Size(242, 20);
this.stTextBox1.Size = new System.Drawing.Size(305, 20);
this.stTextBox1.TabIndex = 6;
//
// stLabel1
//
this.stLabel1.AutoSize = true;
this.stLabel1.Location = new System.Drawing.Point(2, 9);
this.stLabel1.Location = new System.Drawing.Point(12, 9);
this.stLabel1.Name = "stLabel1";
this.stLabel1.Size = new System.Drawing.Size(77, 13);
this.stLabel1.TabIndex = 7;
this.stLabel1.Text = "Texture Name:";
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.pictureBoxCustom1, 1, 0);
this.tableLayoutPanel1.Controls.Add(this.listView1, 0, 0);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 51);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 1;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(1240, 589);
this.tableLayoutPanel1.TabIndex = 8;
//
// Texture_Selector
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.ClientSize = new System.Drawing.Size(672, 408);
this.ClientSize = new System.Drawing.Size(1264, 681);
this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.stLabel1);
this.Controls.Add(this.stTextBox1);
this.Controls.Add(this.button3);
this.Controls.Add(this.RemoveTextureBtn);
this.Controls.Add(this.addTextureBtn);
this.Controls.Add(this.label1);
this.Controls.Add(this.listView1);
this.Controls.Add(this.pictureBoxCustom1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.SizableToolWindow;
this.Name = "Texture_Selector";
this.Text = "Texture Selector";
this.Load += new System.EventHandler(this.Texture_Selector_Load);
((System.ComponentModel.ISupportInitialize)(this.pictureBoxCustom1)).EndInit();
this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -168,12 +182,12 @@
private Toolbox.Library.Forms.PictureBoxCustom pictureBoxCustom1;
private System.Windows.Forms.ListView listView1;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button addTextureBtn;
private System.Windows.Forms.Button RemoveTextureBtn;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.ColumnHeader columnHeader1;
private Toolbox.Library.Forms.STTextBox stTextBox1;
private Toolbox.Library.Forms.STLabel stLabel1;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}

View file

@ -109,7 +109,8 @@ namespace FirstPlugin
if (pictureBoxCustom1.InvokeRequired)
{
pictureBoxCustom1.Invoke((MethodInvoker)delegate {
pictureBoxCustom1.Invoke((MethodInvoker)delegate
{
pictureBoxCustom1.Image = image;
pictureBoxCustom1.Refresh();
});
@ -122,7 +123,7 @@ namespace FirstPlugin
private void listView1_DoubleClick(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
DialogResult = DialogResult.OK;
}
private void addTextureBtn_Click(object sender, EventArgs e)
@ -221,11 +222,25 @@ namespace FirstPlugin
{
e.Graphics.FillRectangle(backBrush, e.Bounds);
}
using (SolidBrush foreBrush = new SolidBrush(Color.FromArgb(255,255,255)))
using (SolidBrush foreBrush = new SolidBrush(Color.FromArgb(255, 255, 255)))
{
e.Graphics.DrawString(e.Header.Text, e.Font, foreBrush, e.Bounds);
}
// e.DrawText();
// e.DrawText();
}
private void listView1_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Enter)
{
if (listView1.SelectedItems.Count > 0)
{
DialogResult = DialogResult.OK;
Close();
}
}
}
}
}
}

View file

@ -134,7 +134,7 @@
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACDTbOhAAAACXBIWXMAAA7DAAAOwwHHb6hkAAAAGXRF
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACDTbOhAAAACXBIWXMAAA7BAAAOwQG4kWvtAAAAGXRF
WHRTb2Z0d2FyZQBwYWludC5uZXQgNC4wLjIx8SBplQAAK8tJREFUeF7t3Qlz21iSBGDZOnifAEiABHif
Ou2e///ftu3OrBILitBMrzzjtvOLaHcHkqsCHnMghfdRuIqyp39d+JIgoM4eCXzdIjCrr4jg3EZAySMS
eMoR0HV4wb9WN0hoGWYc+wioi4D+yBDQzRkJLRtI4DpHQI8dJNT9goTSz0igtUFAu3Adn+KMf4WTuBqF