public void PrintPreview()
{
if (_diagram == null)
{
throw new InvalidOperationException("There is no diagram to print");
}
PrintPreviewDialog previewDlg = new PrintPreviewDialog();
Rectangle bounds = Screen.PrimaryScreen.Bounds;
previewDlg.Width = (int)(bounds.Width * 2f / 3f);
previewDlg.Height = (int)(bounds.Height * 2f / 3f);
previewDlg.StartPosition = FormStartPosition.CenterParent;
previewDlg.UseAntiAlias = true;
previewDlg.Document = _printDocument;
previewDlg.ShowDialog(Form.ActiveForm);
}