十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
软件的帮助文档可借助第三方软件如PDF Reader、Adobe PDF等显示,但客户机上需安装此类软件。WPF开发的软件可借助第三方库 MoonPdf将PDF文档加载显示到软件窗口中(Dll下载地址,GitHub源码地址)。
成都创新互联公司是一家专注于做网站、网站建设与策划设计,城西网站建设哪家好?成都创新互联公司做网站,专注于网站建设10多年,网设计领域的专业建站公司;建站业务涵盖:城西等地区。城西做网站价格咨询:028-86922220
PDFViewer.xaml
PDFViewer.cs
using MoonPdfLib; //记得引用此命名空间
public partial class PdfViewer : UserControl
{
private bool m_bLoaded = false;
public PdfViewer()
{
InitializeComponent();
}
public bool LoadPdfDoc( string strPdfPath )
{
try
{
this.pdfViewer.OpenFile( strPdfPath );
this.pdfViewer.Zoom( 1.0 );
m_bLoaded = true;
}
catch
{
m_bLoaded = false;
}
return m_bLoaded;
}
private void ZoomToOrigin_Click( object sender, RoutedEventArgs e )
{
if ( !m_bLoaded )
return;
this.pdfViewer.Zoom( 1.0 );
}
private void SinglePage_Click( object sender, RoutedEventArgs e )
{
if ( !m_bLoaded )
return;
this.pdfViewer.ViewType = ViewType.SinglePage;
}
private void DoublePage_Click( object sender, RoutedEventArgs e )
{
if ( !m_bLoaded )
return;
this.pdfViewer.ViewType = ViewType.Facing;
}
}
调用PdfViewer,及HelpWin窗口类:HelpWin.xaml
HelpWin.cs
public partial class HelpWin : Window
{
private string m_strPdfPath = AppDomain.CurrentDomain.BaseDirectory + "help.pdf";
public HelpWin()
{
InitializeComponent();
}
private void ImgClose_MouseDown( object sender, MouseButtonEventArgs e )
{
this.Close();
}
private void PDFView_Loaded( object sender, RoutedEventArgs e )
{
if ( !this.PDFView.LoadPdfDoc( m_strPdfPath ) )
{
MessageBox.Show( "打开帮助文档失败,请重试!" );
}
}
}