Vihang,
There is nothing wrong with the code. The code is just not finished. I have updated the function below to include the Print method call.
----------------------------------------------
private void PrintMenuItem_Click(object sender, EventArgs e)
{
WorkflowView workflowView = this.workflowDesignerControl1.WorkflowView;
if (null != workflowView)
{
//select printer
PrintDialog printDialog = new System.Windows.Forms.PrintDialog();
printDialog.AllowPrintToFile = true;
printDialog.AllowCurrentPage = true;
printDialog.AllowSelection = true;
printDialog.AllowSomePages = true;
printDialog.Document = workflowView.PrintDocument;
try
{
DialogResult _result = printDialog.ShowDialog();
if (_result == DialogResult.OK)
{
workflowView.PrintDocument.Print();
}
}
catch
{
string errorString = "Error selecting new printer";
MessageBox.Show(this, errorString, this.Text, MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
}
}
--------------------------------------------------------------------
You may want to update your example (or remove the Print menu).
Sincerely,
John Portnov
|