【发布时间】:2011-10-25 04:01:25
【问题描述】:
我在FlowLayoutPanel上动态添加了Label,代码如下:
private void button1_Click(object sender, EventArgs e)
{
Label lb = new Label();
lb.Text = "How are You";
lb.Size = new Size(650, Font.Height +10);
flowLayoutPanel1.Controls.Add(lb);
flowLayoutPanel1.SetFlowBreak(lb, true);
lb.BackColor = Color.Wheat;
}
在 ContextMenuStrip 中我添加了两个 Item Add 和 Edit 并将其关联 FlowLayoutPanel,意味着当用户右键单击 FlowLayoutPanel 时,Edit 和删除菜单出现。
现在我想使用删除按钮 (ContextMenuStrip) 删除动态添加标签。我只想右键单击欲望标签,右键单击后应该将其删除。与编辑按钮相同的情况进行编辑。
【问题讨论】:
标签: c# flowlayoutpanel