锐腾搅拌上料功能
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
2.2 KiB

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace ICSSoft.Frame.APP
{
public partial class PDFviewerControl : UserControl
{
public PDFviewerControl()
{
InitializeComponent();
}
private void btnRotateLeft_Click(object sender, EventArgs e)
{
pdfViewer1.Renderer.RotateLeft();
}
private void btnRotateRight_Click(object sender, EventArgs e)
{
pdfViewer1.Renderer.RotateRight();
}
/// <summary>
/// 加载pdf文件
/// </summary>
/// <param name="fullfilename">文件绝对路径</param>
public void LoadFile(string fullfilename)
{
if (pdfViewer1.Document != null)
{
pdfViewer1.Document.Dispose();
}
pdfViewer1.Document = OpenDocument(fullfilename);
}
private PdfiumViewer.PdfDocument OpenDocument(string fileName)
{
try
{
MemoryStream ms = new MemoryStream();
using (FileStream fs = new FileStream(fileName, FileMode.Open))
{
fs.CopyTo(ms);
fs.Close();
}
PdfiumViewer.PdfDocument doc = PdfiumViewer.PdfDocument.Load(ms);
return doc;
}
catch (Exception ex)
{
MessageBox.Show(this, ex.Message, Text, MessageBoxButtons.OK, MessageBoxIcon.Error);
return null;
}
}
public void Close()
{
if (pdfViewer1.Document != null)
{
pdfViewer1.Document.Dispose();
}
pdfViewer1.Dispose();
this.Dispose();
}
private void btnPre_Click(object sender, EventArgs e)
{
pdfViewer1.Renderer.Page--;
}
private void btnNext_Click(object sender, EventArgs e)
{
pdfViewer1.Renderer.Page++;
}
}
}