pdfViewer1.DocumentChanged
+= new DevExpress.XtraPdfViewer.PdfDocumentChangedEventHandler(pdfViewer1_DocumentChanged); } /// void pdfViewer1_DocumentChanged(object sender,DevExpress.XtraPdfViewer.PdfDocumentChangedEventArgs
e) { string fileName = Path.GetFileName(e.DocumentFilePath); if (String.IsNullOrEmpty(fileName)) { Text = mainFormText; } else { Text = fileName + ” – ” + mainFormText; } } /// <summary> /// 打开PDF文件 /// </summary> private void btnOpenFile_Click(object sender, EventArgs e) { string filePath = FileDialogHelper.OpenPdf(); if (!string.IsNullOrEmpty(filePath)) { this.pdfViewer1.LoadDocument(filePath); } } /// <summary> /// 另存为PDF文件 /// </summary> private void btnSaveAs_Click(object sender, EventArgs e) { string dir = System.Environment.CurrentDirectory; string filePath = FileDialogHelper.SavePdf(“”, dir); if (!string.IsNullOrEmpty(filePath)) { try { this.pdfViewer1.SaveDocument(filePath); MessageUtil.ShowTips(“保存成功”); } catch (Exception ex) { LogTextHelper.Error(ex); MessageUtil.ShowError(ex.Message); } } } /// <summary> /// PDF文件打印 /// </summary> private void btnPreview_Click(object sender, EventArgs e) { this.pdfViewer1.Print(); } }