基本信息
源码名称:O2S.Samples.PDFView4NET.Bookmarks
源码大小:34.27M
文件格式:.zip
开发语言:C#
更新时间:2020-12-09
友情提示:(无需注册或充值,赞助后即可获取资源下载链接)
嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559
本次赞助数额为: 2 元×
微信扫码支付:2 元
×
请留下您的邮箱,我们将在2小时内将文件发到您的邮箱
源码介绍
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Globalization;
using System.Windows.Forms;
using O2S.Components.PDFView4NET;
namespace O2S.Samples.PDFView4NET.Bookmarks
{
public partial class MainForm : Form
{
public MainForm()
{
InitializeComponent();
}
private void MainForm_Load(object sender, EventArgs e)
{
pdfDocument.FilePath = "..\\..\\..\\..\\SupportFiles\\Bookmarks.pdf";
}
private void btnBrowse_Click(object sender, EventArgs e)
{
if (ofd.ShowDialog() == DialogResult.OK)
{
txtPDFFile.Text = ofd.FileName;
pdfDocument.FilePath = ofd.FileName;
}
}
private void btnFirst_Click(object sender, EventArgs e)
{
pdfPageView.GoToFirstPage();
}
private void btnPrev_Click(object sender, EventArgs e)
{
pdfPageView.GoToPrevPage();
}
private void btnNext_Click(object sender, EventArgs e)
{
pdfPageView.GoToNextPage();
}
private void btnLast_Click(object sender, EventArgs e)
{
pdfPageView.GoToLastPage();
}
private void cbxZoom_SelectedIndexChanged(object sender, EventArgs e)
{
pdfPageView.Zoom = float.Parse(cbxZoom.Text, CultureInfo.InvariantCulture);
}
private void pdfBookmarksView_BookmarkClick(object sender, O2S.Components.PDFView4NET.BookmarkClickEventArgs e)
{
if (e.MouseButton == MouseButtons.Right)
{
cmsBookmarks.Show(pdfBookmarksView.PointToScreen(e.Location));
}
}
private void tsmiBookmarkEdit_Click(object sender, EventArgs e)
{
pdfBookmarksView.SelectedNode.BeginEdit();
}
private void tsmiBookmarkAdd_Click(object sender, EventArgs e)
{
// Create the new bookmark.
PDFBookmark newBookmark = new PDFBookmark();
newBookmark.Title = "New bookmark";
// The new bookmark does the same thing like its parent.
newBookmark.Action = pdfBookmarksView.SelectedBookmark.Action;
// Add the bookmark to collection.
pdfBookmarksView.SelectedBookmark.Bookmarks.Add(newBookmark);
}
private void tsmiBookmarkRemove_Click(object sender, EventArgs e)
{
// Top level bookmark.
if (pdfBookmarksView.SelectedBookmark.Parent == null)
{
// Remove the bookmark from document's collection.
pdfDocument.Bookmarks.Remove(pdfBookmarksView.SelectedBookmark);
}
else // Nested bookmark.
{
// Remove the bookmark from its parent collection.
pdfBookmarksView.SelectedBookmark.Parent.Bookmarks.Remove(pdfBookmarksView.SelectedBookmark);
}
}
}
}