/// <summary> /// 翻页 /// </summary> /// <param name="isPre"></param> public void PageSelect(bool isPre) { richEditControl1.Document.ChangeActiveDocument(richEditControl1.Document); int currentPageIndex = ((DevExpress.XtraRichEdit.PageBasedRichEditView)richEditControl1.ActiveView).CurrentPageIndex;//获取当前的页面Index LayoutPage page; if (isPre) { if (currentPageIndex == 0) return; page = richEditControl1.DocumentLayout.GetPage(currentPageIndex - 1); } else { if (currentPageIndex == richEditControl1.DocumentLayout.GetPageCount() - 1) return; page = richEditControl1.DocumentLayout.GetPage(currentPageIndex + 1); } ScrollToPosition(page.MainContentRange.Start); } /// <summary> /// 滚动指定位置 /// </summary> /// <param name="position"></param> void ScrollToPosition(int position) { richEditControl1.Document.CaretPosition = richEditControl1.Document.CreatePosition(position); richEditControl1.ScrollToCaret(0.5f); }
/// <summary> /// 翻页 /// </summary> /// <param name="isPre"></param> public void PageSelect(bool isPre) { if (isPre) { PreviousPageCommand prePage = new PreviousPageCommand(richEditControl1); prePage.CreateDefaultCommandUIState(); prePage.Execute(); } else { NextPageCommand nextPage = new NextPageCommand(richEditControl1); nextPage.CreateDefaultCommandUIState(); nextPage.Execute(); } }