ContextMenu menuUnitButton = new ContextMenu();
MenuItem menuItemDelete = new MenuItem("Delete (&D)");
menuItemDelete.Click += new EventHandler(menuItemDelete_Click);
menuUnitButton.MenuItems.Add(menuItemDelete);
((CustomButton)htControls[i]).ContextMenu = menuUnitButton;
private void menuItemDelete_Click(object sender, EventArgs e)
{
// string name = menuUnitButton.SourceControl.Name;
//MessageBox.Show(name);
int htIndex = Int16.Parse(((CustomButton)menuUnitButton.SourceControl).Name.Substring(10));
}
--
Feng
MenuItem menuItemDelete = new MenuItem("Delete (&D)");
menuItemDelete.Click += new EventHandler(menuItemDelete_Click);
menuUnitButton.MenuItems.Add(menuItemDelete);
((CustomButton)htControls[i]).ContextMenu = menuUnitButton;
private void menuItemDelete_Click(object sender, EventArgs e)
{
// string name = menuUnitButton.SourceControl.Name;
//MessageBox.Show(name);
int htIndex = Int16.Parse(((CustomButton)menuUnitButton.SourceControl).Name.Substring(10));
}
--
Feng
没有评论:
发表评论