评论会员:OriginalGriff 时间:2012/02/07
Click事件处理的附加和删除按钮:
private Button runTimeButton = null;
private void butAdd_Click(object sender, EventArgs e)
{
Button but = sender as Button;
if (but != null)
{
if (runTimeButton == null)
{
runTimeButton = new Button();
runTimeButton.Text = "Added!";
runTimeButton.Location = new Point(but.Location.X, but.Location.Y + 30);
runTimeButton.Click += new EventHandler(runTimeButton_Click);
Controls.Add(runTimeButton);
}
}
}
void runTimeButton_Click(object sender, EventArgs e)
{
MessageBox.Show("Added Button Clicked!");
}
private void butRemove_Click(object sender, EventArgs e)
{
if (runTimeButton != null)
{
Controls.Remove(runTimeButton);
runTimeButton.Click -= runTimeButton_Click;
runTimeButton = null;
}
}
不过,如果你是在添加大量信息的用户,你可能要考虑使用一个DataGridView,而不是 - 它是为用户设计,添加和删除行
当涉及到印刷,不要让用户移动任何东西!
不要尝试打印的实际形式 - 它会惨不忍睹。相反,使用
]处理您的打印输出 - 它可以让你完全控制什么和打印的东西,包括字体,大小,颜色等,不以任何方式与屏幕显示
评论会员:。agent154 时间:2012/02/07
。关于印刷的问题,我想我本来可以更清晰
我有它设置存储在XML文档中的配方数据,并正在使用XSL和CSS,该文件将显示在一个正常的网页浏览器,如果用户选择。它也使用同样的技术,显示在我的WinForm的配方。我希望用户能够命令列表中的成分,为了使逻辑意义。该网页将被打印。
我会考虑DataGridView控件,虽然。听起来像它可能是最好的选择