禁用打印预览里的打印按钮
请教下:如何才能禁用打印预览里的打印按钮,在网上打到一段代码不知道放在什么地方。
PrintPreviewDialog ppDlg = new PrintPreviewDialog();
//ppDlg.Controls[1].Visible = false;
ToolStrip tool = ppDlg.Controls[1] as ToolStrip;
if (tool != null)
{
tool.Items["printToolStripButton"].Visible= false;
}
上面的是整个toolstrip禁用。这个是只禁用打印按钮。
http://topic.csdn.net/u/20111224/08/8e19a43e-ab6c-4a41-9ed8-6f3a22f37963.html?seed=1165979838&r=79253999#r_79253999
------解决方案--------------------
C# code
private void button1_Click(object sender, EventArgs e)
{
PrintPreviewDialog ppDlg = new PrintPreviewDialog();
ToolStrip tool = ppDlg.Controls[1] as ToolStrip;
if (tool != null)
{
tool.Items["printToolStripButton"].Visible = false;
}
ppDlg.ShowDialog();
}