DeviceManager/TsSFCDevice.Client.Launch/Common/pagePDFView.cs
2024-08-02 10:52:45 +08:00

58 lines
1.7 KiB
C#

using DevExpress.XtraEditors;
using DevExpress.XtraPdfViewer;
using DeviceRepair.Utils;
using System;
using System.IO;
namespace TsSFCDevice.Client.Launch.Common
{
//GetDownPDFFile
public partial class pagePDFView : XtraForm
{
int CurrentAttaID = 0;
string FormCaption = string.Empty;
public pagePDFView(string Caption, int pk)
{
FormCaption = Caption;
CurrentAttaID = pk;
InitializeComponent();
this.Load += PagePDFView_Load;
}
private void PagePDFView_Load(object sender, EventArgs e)
{
pdfViewer1.PopupMenuShowing += pdfViewer1_PopupMenuShowing;
this.Text = (FormCaption ?? "预览");
try
{
splashScreenManager1.ShowWaitForm();
string result = "";// PreserveManager.Instance.GetPDFFile(CurrentAttaID);
byte[] btResult = IOExtend.FileToByteArray(result);
MemoryStream pdfStream = new MemoryStream(btResult);
pdfViewer1.LoadDocument(pdfStream);
splashScreenManager1.TryCloseWait();
}
catch (Exception ex)
{
splashScreenManager1.TryCloseWait();
XtraMessageBoxHelper.Error(ex.Message);
}
}
/// <summary>
/// 右键菜单
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void pdfViewer1_PopupMenuShowing(object sender, PdfPopupMenuShowingEventArgs e)
{
if (e.PopupMenuKind == PdfPopupMenuKind.PageContent)
e.ItemLinks.Clear();
//e.ItemLinks[0].Visible = false;
}
}
}