Neue Funktion
- Die erzeugten Menueinträge können abgefragt werden
This commit is contained in:
parent
bbb8809ed7
commit
8fcff02d51
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -360,6 +360,24 @@ namespace Eugen.ESystem
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns a list of all submenus
|
||||
/// </summary>
|
||||
/// <returns>Item list</returns>
|
||||
public string[] GetSubMenuItems()
|
||||
{
|
||||
ToolStripMenuItem menu = (ToolStripMenuItem)(Menu);
|
||||
|
||||
string[] items = new string[menu.DropDownItems.Count];
|
||||
|
||||
for (int i = 0; i < menu.DropDownItems.Count; i++)
|
||||
{
|
||||
items[i] = menu.DropDownItems[i].ToString();
|
||||
}
|
||||
|
||||
return items;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Saves a license value to the roaming area
|
||||
/// </summary>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
15
Test_DynamicMenuItems/Form1.Designer.cs
generated
15
Test_DynamicMenuItems/Form1.Designer.cs
generated
@ -41,6 +41,7 @@
|
||||
this.buttonRemoveItem = new System.Windows.Forms.Button();
|
||||
this.buttonRemoveItems = new System.Windows.Forms.Button();
|
||||
this.buttonRemoveAllMenuItems = new System.Windows.Forms.Button();
|
||||
this.labelResult = new System.Windows.Forms.Label();
|
||||
this.groupBoxProgramInfo.SuspendLayout();
|
||||
this.groupBoxDLLInfo.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
@ -117,7 +118,7 @@
|
||||
// subtestToolStripMenuItem
|
||||
//
|
||||
this.subtestToolStripMenuItem.Name = "subtestToolStripMenuItem";
|
||||
this.subtestToolStripMenuItem.Size = new System.Drawing.Size(113, 22);
|
||||
this.subtestToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.subtestToolStripMenuItem.Text = "Subtest";
|
||||
//
|
||||
// buttonAddmenuItems
|
||||
@ -170,11 +171,22 @@
|
||||
this.buttonRemoveAllMenuItems.UseVisualStyleBackColor = true;
|
||||
this.buttonRemoveAllMenuItems.Click += new System.EventHandler(this.buttonRemoveAllMenuItems_Click);
|
||||
//
|
||||
// labelResult
|
||||
//
|
||||
this.labelResult.AutoSize = true;
|
||||
this.labelResult.Location = new System.Drawing.Point(12, 28);
|
||||
this.labelResult.Name = "labelResult";
|
||||
this.labelResult.Size = new System.Drawing.Size(16, 13);
|
||||
this.labelResult.TabIndex = 19;
|
||||
this.labelResult.Text = "...";
|
||||
this.labelResult.TextAlign = System.Drawing.ContentAlignment.TopCenter;
|
||||
//
|
||||
// Form1
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(800, 450);
|
||||
this.Controls.Add(this.labelResult);
|
||||
this.Controls.Add(this.buttonRemoveAllMenuItems);
|
||||
this.Controls.Add(this.buttonRemoveItems);
|
||||
this.Controls.Add(this.buttonRemoveItem);
|
||||
@ -214,6 +226,7 @@
|
||||
private System.Windows.Forms.Button buttonRemoveItem;
|
||||
private System.Windows.Forms.Button buttonRemoveItems;
|
||||
private System.Windows.Forms.Button buttonRemoveAllMenuItems;
|
||||
private System.Windows.Forms.Label labelResult;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -153,6 +153,12 @@ namespace Test_DynamicMenuItems
|
||||
|
||||
string[] items = { "NX91110", "NX93300", "SC13500" };
|
||||
dmi.AddMenuItems(items); //Menüeinträge aus einer List erzeugen
|
||||
|
||||
labelResult.Text = "";
|
||||
foreach (var item in dmi.GetSubMenuItems())
|
||||
{
|
||||
labelResult.Text += item + "\n\r";
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonAddMenuItemsFromXML_Click(object sender, EventArgs e)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user