fixes
This commit is contained in:
parent
340c3f2dc6
commit
59c689b9a2
|
|
@ -35,12 +35,12 @@
|
|||
this.partColorsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.XMLView = new System.Windows.Forms.DataGridView();
|
||||
this.ContextMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.XMLContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.insertRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.deleteRowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.XMLStrip.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.XMLView)).BeginInit();
|
||||
this.ContextMenu.SuspendLayout();
|
||||
this.XMLContextMenuStrip.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// XMLStrip
|
||||
|
|
@ -98,6 +98,7 @@
|
|||
//
|
||||
// XMLView
|
||||
//
|
||||
this.XMLView.AllowUserToOrderColumns = true;
|
||||
this.XMLView.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)));
|
||||
|
|
@ -111,14 +112,15 @@
|
|||
this.XMLView.Size = new System.Drawing.Size(800, 426);
|
||||
this.XMLView.TabIndex = 30;
|
||||
this.XMLView.CellMouseUp += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.XMLView_CellMouseUp);
|
||||
this.XMLView.MouseClick += new System.Windows.Forms.MouseEventHandler(this.XMLView_MouseClick);
|
||||
//
|
||||
// ContextMenu
|
||||
// XMLContextMenuStrip
|
||||
//
|
||||
this.ContextMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.XMLContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.insertRowToolStripMenuItem,
|
||||
this.deleteRowToolStripMenuItem});
|
||||
this.ContextMenu.Name = "contextMenuStrip1";
|
||||
this.ContextMenu.Size = new System.Drawing.Size(134, 48);
|
||||
this.XMLContextMenuStrip.Name = "contextMenuStrip1";
|
||||
this.XMLContextMenuStrip.Size = new System.Drawing.Size(134, 48);
|
||||
//
|
||||
// insertRowToolStripMenuItem
|
||||
//
|
||||
|
|
@ -149,7 +151,7 @@
|
|||
this.XMLStrip.ResumeLayout(false);
|
||||
this.XMLStrip.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.XMLView)).EndInit();
|
||||
this.ContextMenu.ResumeLayout(false);
|
||||
this.XMLContextMenuStrip.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
|
@ -163,7 +165,7 @@
|
|||
private System.Windows.Forms.ToolStripMenuItem partColorsToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem saveToolStripMenuItem;
|
||||
private System.Windows.Forms.DataGridView XMLView;
|
||||
private System.Windows.Forms.ContextMenuStrip ContextMenu;
|
||||
private System.Windows.Forms.ContextMenuStrip XMLContextMenuStrip;
|
||||
private System.Windows.Forms.ToolStripMenuItem insertRowToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem deleteRowToolStripMenuItem;
|
||||
}
|
||||
|
|
@ -47,6 +47,11 @@ public partial class XMLContentEditor : Form
|
|||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (XMLView.CurrentCell.IsInEditMode)
|
||||
{
|
||||
XMLView.EndEdit();
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/37145086/datagridview-remove-empty-rows-button
|
||||
for (int i = XMLView.Rows.Count - 1; i > -1; i--)
|
||||
{
|
||||
|
|
@ -152,7 +157,7 @@ public partial class XMLContentEditor : Form
|
|||
XMLView.Rows[e.RowIndex].Selected = true;
|
||||
rowIndex = e.RowIndex;
|
||||
XMLView.CurrentCell = XMLView.Rows[e.RowIndex].Cells[1];
|
||||
ContextMenu.Show(Cursor.Position);
|
||||
XMLContextMenuStrip.Show(Cursor.Position);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -171,6 +176,20 @@ public partial class XMLContentEditor : Form
|
|||
XMLView.Rows.Insert(rowIndex, 1);
|
||||
}
|
||||
}
|
||||
|
||||
//https://stackoverflow.com/questions/14431936/how-to-force-datagridviewcell-to-end-edit-when-row-header-is-clicked/14498870
|
||||
private void XMLView_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (XMLView.HitTest(e.X, e.Y).Type == DataGridViewHitTestType.RowHeader)
|
||||
{
|
||||
XMLView.EditMode = DataGridViewEditMode.EditOnKeystrokeOrF2;
|
||||
XMLView.EndEdit();
|
||||
}
|
||||
else
|
||||
{
|
||||
XMLView.EditMode = DataGridViewEditMode.EditOnEnter;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region Functions
|
||||
|
|
@ -217,16 +236,22 @@ public partial class XMLContentEditor : Form
|
|||
{
|
||||
XMLView.ColumnCount = 3;
|
||||
XMLView.Columns[0].Name = "Name";
|
||||
XMLView.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
XMLView.Columns[1].Name = "URL";
|
||||
XMLView.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
XMLView.Columns[2].Name = "Icon File";
|
||||
XMLView.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
ListType = XMLContentType.ContentProviders;
|
||||
}
|
||||
else if (loaderList.OfType<PartColor>().Any())
|
||||
{
|
||||
XMLView.ColumnCount = 3;
|
||||
XMLView.Columns[0].Name = "Name";
|
||||
XMLView.Columns[0].SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
XMLView.Columns[1].Name = "ID";
|
||||
XMLView.Columns[1].SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
XMLView.Columns[2].Name = "RGB Value";
|
||||
XMLView.Columns[2].SortMode = DataGridViewColumnSortMode.NotSortable;
|
||||
ListType = XMLContentType.PartColors;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@
|
|||
<metadata name="XMLStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
<metadata name="ContextMenu.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<metadata name="XMLContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>118, 17</value>
|
||||
</metadata>
|
||||
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
|
||||
|
|
|
|||
Loading…
Reference in New Issue