• DevExpress RichEditControl 上下翻页功能 z


    /// <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();
    
                }
    
    }

    GIF1.gif

  • 相关阅读:
    AE Featureclass 添加字段
    C# AE 打开本地数据
    C# DataTable操作
    IDL + AE + C#
    C#, HashTable
    KMeans Clustering
    C#打开外部程序
    二叉树删除操作(java)
    python小游戏水文
    QQ机器人
  • 原文地址:https://www.cnblogs.com/zeroone/p/6589342.html
Copyright © 2020-2023  润新知