示例#1
0
        /// <summary>
        /// Create Guide. if position > max, create failed.
        /// </summary>
        private bool CreateGuide(Orientation orient, int x, int y)
        {
            if (orient == Orientation.Vertical)
            {
                if (x > CommonDefine.MaxEditorWidth)
                {
                    return(false);
                }
            }
            else
            {
                if (y > CommonDefine.MaxEditorHeight)
                {
                    return(false);
                }
            }

            if (_isGlobalChecked)
            {
                IGuide guide = _document.CreateGlobalGuide(orient, x, y);
                _guideList.Add(guide);
            }
            else
            {
                IPageView pageView = _page.PageViews.GetPageView(SelectionService.GetCurrentPage().CurAdaptiveViewGID);
                if (pageView != null)
                {
                    IGuide guide = pageView.CreateGuide(orient, x, y);
                    _guideList.Add(guide);
                }
            }
            return(true);
        }