• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# ITextPointer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中ITextPointer的典型用法代码示例。如果您正苦于以下问题:C# ITextPointer类的具体用法?C# ITextPointer怎么用?C# ITextPointer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ITextPointer类属于命名空间,在下文中一共展示了ITextPointer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: TextParentUndoUnit

        internal TextParentUndoUnit(ITextSelection selection, ITextPointer anchorPosition, ITextPointer movingPosition)
            : base(String.Empty)
        {
            _selection = selection;

            _undoAnchorPositionOffset = anchorPosition.Offset;
            _undoAnchorPositionDirection = anchorPosition.LogicalDirection;
            _undoMovingPositionOffset = movingPosition.Offset;
            _undoMovingPositionDirection = movingPosition.LogicalDirection;

            // Bug 1706768: we are seeing unitialized values when the undo
            // undo is pulled off the undo stack. _redoAnchorPositionOffset
            // and _redoMovingPositionOffset are supposed to be initialized
            // with calls to RecordRedoSelectionState before that happens.
            //
            // This code path is being left enabled in DEBUG to help track down
            // the underlying bug post V1.
#if DEBUG
            _redoAnchorPositionOffset = -1;
            _redoMovingPositionOffset = -1;
#else
            _redoAnchorPositionOffset = 0;
            _redoMovingPositionOffset = 0;
#endif
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:25,代码来源:TextParentUndoUnit.cs


示例2: FireChangedEvent

 // Raises a Changed event for any listeners, covering the
 // specified text.
 internal void FireChangedEvent(ITextPointer start, ITextPointer end)
 {
     if (Changed != null)
     {
         Changed(this, new SpellerHighlightChangedEventArgs(start, end));
     }
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:SpellerHighlightLayer.cs


示例3: DocumentSequenceTextPointer

 //------------------------------------------------------
 //
 //  Constructors
 //
 //------------------------------------------------------
 #region Constructors
 // Ctor always set mutable flag to false
 internal DocumentSequenceTextPointer(ChildDocumentBlock childBlock, ITextPointer childPosition)
 {
     Debug.Assert(childBlock != null);
     Debug.Assert(childPosition != null);
     _childBlock = childBlock;
     _childTp = childPosition;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:documentsequencetextpointer.cs


示例4: SpellerStatusTable

        //------------------------------------------------------
        //
        //  Constructors
        //
        //------------------------------------------------------

        #region Constructors

        // Constructor.
        internal SpellerStatusTable(ITextPointer textContainerStart, SpellerHighlightLayer highlightLayer)
        {
            _highlightLayer = highlightLayer;

            _runList = new ArrayList(1);

            _runList.Add(new Run(textContainerStart, RunType.Dirty));
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:17,代码来源:SpellerStatusTable.cs


示例5: SpellingError

        //-----------------------------------------------------
        //
        //  Constructors 
        //
        //----------------------------------------------------- 
 
        #region Constructors
 
        // Creates a new instance.
        internal SpellingError(Speller speller, ITextPointer start, ITextPointer end)
        {
            Invariant.Assert(start.CompareTo(end) < 0); 

            _speller = speller; 
            _start = start.GetFrozenPointer(LogicalDirection.Forward); 
            _end = end.GetFrozenPointer(LogicalDirection.Backward);
        } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:17,代码来源:SpellerError.cs


示例6: TextContainerChangeEventArgs

 internal TextContainerChangeEventArgs(ITextPointer textPosition, int count, int charCount, TextChangeType textChange, DependencyProperty property, bool affectsRenderOnly) 
 {
     _textPosition = textPosition.GetFrozenPointer(LogicalDirection.Forward); 
     _count = count; 
     _charCount = charCount;
     _textChange = textChange; 
     _property = property;
     _affectsRenderOnly = affectsRenderOnly;
 }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:9,代码来源:TextContainerChangeEventArgs.cs


示例7: VerifyPosition

        // Verifies a TextPointer is non-null and is associated with a given TextContainer.
        //
        // Throws an appropriate exception if a test fails.
        internal static void VerifyPosition(ITextContainer container, ITextPointer position, string paramName)
        {
            if (position == null)
            {
                throw new ArgumentNullException(paramName);
            }

            if (position.TextContainer != container)
            {
                throw new ArgumentException(SR.Get(SRID.NotInAssociatedTree, paramName));
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:15,代码来源:ValidationHelper.cs


示例8: GetRectangleFromTextPosition

 /// <summary> 
 /// <see cref="ITextView.GetRectangleFromTextPosition"/>
 /// </summary> 
 /// <remarks> 
 /// Calls GetRawRectangleFromTextPosition to get a rect and a transform, and applies the transform to the
 /// rect. 
 /// </remarks>
 internal virtual Rect GetRectangleFromTextPosition(ITextPointer position)
 {
     Transform transform; 
     Rect rect = GetRawRectangleFromTextPosition(position, out transform);
     // Transform must not be null. TextViews returning no transform should return identity 
     Invariant.Assert(transform != null); 
     if (rect != Rect.Empty)
     { 
         rect = transform.TransformBounds(rect);
     }
     return rect;
 } 
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:19,代码来源:TextViewBase.cs


示例9: GetTextInRun

        // Worker for GetText, accepts any ITextPointer.
        internal static string GetTextInRun(ITextPointer position, LogicalDirection direction)
        {
            char[] text;
            int textLength;
            int getTextLength;

            textLength = position.GetTextRunLength(direction);
            text = new char[textLength];

            getTextLength = position.GetTextInRun(direction, text, 0, textLength);
            Invariant.Assert(getTextLength == textLength, "textLengths returned from GetTextRunLength and GetTextInRun are innconsistent");

            return new string(text);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:15,代码来源:TextPointerBase.cs


示例10: TextRange

        // ignoreTextUnitBoundaries - true if normalization should ignore text
        // normalization (surrogates, combining marks, etc).
        // Used for fine-grained control by IMEs.
        internal TextRange(ITextPointer position1, ITextPointer position2, bool ignoreTextUnitBoundaries)
        {
            if (position1 == null)
            {
                throw new ArgumentNullException("position1");
            }
            if (position2 == null)
            {
                throw new ArgumentNullException("position2");
            }

            SetFlags(ignoreTextUnitBoundaries, Flags.IgnoreTextUnitBoundaries);

            ValidationHelper.VerifyPosition(position1.TextContainer, position1, "position1");
            ValidationHelper.VerifyPosition(position1.TextContainer, position2, "position2");

            TextRangeBase.Select(this, position1, position2);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:21,代码来源:TextRange.cs


示例11: TextSegment

        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="startPosition">
        /// Position preceeding the TextSegment's content.
        /// </param>
        /// <param name="endPosition">
        /// Position following the TextSegment's content.
        /// </param>
        /// <param name="preserveLogicalDirection">
        /// Whether preserves LogicalDirection of start and end positions.
        /// </param>
        internal TextSegment(ITextPointer startPosition, ITextPointer endPosition, bool preserveLogicalDirection)
        {
            ValidationHelper.VerifyPositionPair(startPosition, endPosition);

            if (startPosition.CompareTo(endPosition) == 0)
            {
                // To preserve segment emptiness
                // we use the same instance of a pointer
                // for both segment ends.
                _start = startPosition.GetFrozenPointer(startPosition.LogicalDirection);
                _end = _start;
            }
            else
            {
                Invariant.Assert(startPosition.CompareTo(endPosition) < 0);
                _start = startPosition.GetFrozenPointer(preserveLogicalDirection ? startPosition.LogicalDirection : LogicalDirection.Backward);
                _end = endPosition.GetFrozenPointer(preserveLogicalDirection ? endPosition.LogicalDirection : LogicalDirection.Forward);
            }
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:31,代码来源:TextSegment.cs


示例12: VerifyPositionPair

 // Verifies two positions are safe to use as a logical text span.
 //
 // Throws ArgumentNullException if startPosition == null || endPosition == null
 //        ArgumentException if startPosition.TextContainer != endPosition.TextContainer or
 //                             startPosition > endPosition
 internal static void VerifyPositionPair(ITextPointer startPosition, ITextPointer endPosition)
 {
     if (startPosition == null)
     {
         throw new ArgumentNullException("startPosition");
     }
     if (endPosition == null)
     {
         throw new ArgumentNullException("endPosition");
     }
     if (startPosition.TextContainer != endPosition.TextContainer)
     {
         throw new ArgumentException(SR.Get(SRID.InDifferentTextContainers, "startPosition", "endPosition"));
     }
     if (startPosition.CompareTo(endPosition) > 0)
     {
         throw new ArgumentException(SR.Get(SRID.BadTextPositionOrder, "startPosition", "endPosition"));
     }
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:24,代码来源:ValidationHelper.cs


示例13: GetTextWithLimit

        // Like GetText, excepts also accepts a limit parameter -- no text is returned past
        // this second position.
        // limit may be null, in which case it is ignored.
        internal static int GetTextWithLimit(ITextPointer thisPointer, LogicalDirection direction, char[] textBuffer, int startIndex, int count, ITextPointer limit)
        {
            int charsCopied;

            if (limit == null)
            {
                // No limit, just call GetText.
                charsCopied = thisPointer.GetTextInRun(direction, textBuffer, startIndex, count);
            }
            else if (direction == LogicalDirection.Forward && limit.CompareTo(thisPointer) <= 0)
            {
                // Limit completely blocks the read.
                charsCopied = 0;
            }
            else if (direction == LogicalDirection.Backward && limit.CompareTo(thisPointer) >= 0)
            {
                // Limit completely blocks the read.
                charsCopied = 0;
            }
            else
            {
                int maxCount;

                // Get an upper bound on the amount of text to copy.
                // Since GetText always stops on non-text boundaries, it's
                // ok if the count too high, it will get truncated anyways.
                if (direction == LogicalDirection.Forward)
                {
                    maxCount = Math.Min(count, thisPointer.GetOffsetToPosition(limit));
                }
                else
                {
                    maxCount = Math.Min(count, limit.GetOffsetToPosition(thisPointer));
                }
                maxCount = Math.Min(count, maxCount);

                charsCopied = thisPointer.GetTextInRun(direction, textBuffer, startIndex, maxCount);
            }

            return charsCopied;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:44,代码来源:TextPointerBase.cs


示例14: Apply

        /// <summary>
        ///   Apply the display attribute to to the given range.
        /// </summary>
        internal void Apply(ITextPointer start, ITextPointer end)
        {
            //
            // 


             
#if NOT_YET
            if (_attr.crText.type != UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_NONE)
            {
            }

            if (_attr.crBk.type != UnsafeNativeMethods.TF_DA_COLORTYPE.TF_CT_NONE)
            {
            }

            if (_attr.lsStyle != UnsafeNativeMethods.TF_DA_LINESTYLE.TF_LS_NONE)
            {
            }
#endif

        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:TextServicesDisplayAttribute.cs


示例15: if

        /// <summary>
        /// Compares this TextPointer with another TextPointer.
        /// </summary>
        /// <param name="position">
        /// The TextPointer to compare with.
        /// </param>
        /// <returns>
        /// Less than zero: this TextPointer preceeds position.
        /// Zero: this TextPointer is at the same location as position.
        /// Greater than zero: this TextPointer follows position.
        /// </returns>
        int ITextPointer.CompareTo(ITextPointer position)
        {
            int offset;
            int result;

            offset = ((PasswordTextPointer)position)._offset;

            if (_offset < offset)
            {
                result = -1;
            }
            else if (_offset > offset)
            {
                result = +1;
            }
            else
            {
                result = 0;
            }

            return result;
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:33,代码来源:PasswordTextNavigator.cs


示例16: GetFirstDirtyRange

        // Returns the first dirty run following a specified position in the document.
        // start/end will be left null if no dirty ranges are found.
        internal void GetFirstDirtyRange(ITextPointer searchStart, out ITextPointer start, out ITextPointer end)
        {
            int index;
            Run run;

            start = null;
            end = null;

            // If this is ever slow enough to matter, we could cache the value.
            for (index = FindIndex(searchStart.CreateStaticPointer(), LogicalDirection.Forward); index >= 0 && index < _runList.Count; index++)
            {
                run = GetRun(index);

                if (run.RunType == RunType.Dirty)
                {
                    // We might get a hit in the first run, in which case start <= searchStart.
                    // Always return searchStart as a minimum.
                    start = TextPointerBase.Max(searchStart, run.Position);
                    end = GetRunEndPositionDynamic(index);
                    break;
                }
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:25,代码来源:SpellerStatusTable.cs


示例17: Contains

        //----------------------------------------------------- 
        //
        // ITextRange Methods
        //
        //----------------------------------------------------- 

        #region ITextRange Methods 
 
        //......................................................
        // 
        // Selection Building
        //
        //......................................................
 
        /// <summary>
        /// </summary> 
        // 
        internal static bool Contains(ITextRange thisRange, ITextPointer textPointer)
        { 
            NormalizeRange(thisRange);

            if (textPointer == null)
            { 
                throw new ArgumentNullException("textPointer");
            } 
 
            if (textPointer.TextContainer != thisRange.Start.TextContainer)
            { 
                throw new ArgumentException(SR.Get(SRID.NotInAssociatedTree), "textPointer");
            }

            // Correct position normalization on range boundary so that 
            // our test would not depend on what side of formatting tags
            // pointer is located. 
            if (textPointer.CompareTo(thisRange.Start) < 0) 
            {
                textPointer = textPointer.GetFormatNormalizedPosition(LogicalDirection.Forward); 
            }
            else if (textPointer.CompareTo(thisRange.End) > 0)
            {
                textPointer = textPointer.GetFormatNormalizedPosition(LogicalDirection.Backward); 
            }
 
            // Check if at least one segment contains this position. 
            for (int i = 0; i < thisRange._TextSegments.Count; i++)
            { 
                if (thisRange._TextSegments[i].Contains(textPointer))
                {
                    return true;
                } 
            }
 
            return false; 
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:54,代码来源:TextRangeBase.cs


示例18: InsertText

        //------------------------------------------------------
        //
        //  Internal Methods
        // 
        //-----------------------------------------------------
 
        #region Internal Methods 

        /// <summary> 
        /// Inserts text at a specified position.
        /// </summary>
        /// <param name="position">
        /// Position at which to insert the new text. 
        /// </param>
        /// <param name="textData"> 
        /// Text to insert. 
        /// </param>
        /// <remarks> 
        /// Use the CanInsertText method to determine if text may be inserted
        /// at position.
        ///
        /// All positions at this location are repositioned 
        /// before or after the inserted text according to their gravity.
        /// </remarks> 
        internal void InsertText(ITextPointer position, string textData) 
        {
            int offset; 
            int i;

            BeginChange();
            try 
            {
                offset = ((PasswordTextPointer)position).Offset; 
 
                // Strangely, there is no SecureString.InsertAt(offset, string), so
                // we must use a loop here. 
                for (i = 0; i < textData.Length; i++)
                {
                    _password.InsertAt(offset + i, textData[i]);
                } 

                OnPasswordChange(offset, textData.Length); 
            } 
            finally
            { 
                EndChange();
            }
        }
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:48,代码来源:PasswordTextContainer.cs


示例19: GetParagraphsFromPosition

        /// <summary>
        /// Returns the paragraphs for the appropriate cell, given a point
        /// </summary>
        /// <param name="position">Position of cell.</param>
        /// <returns>
        /// Array of paragraph results
        /// </returns>
        internal ReadOnlyCollection<ParagraphResult> GetParagraphsFromPosition(ITextPointer position)
        {
            CellParaClient cpc = GetCellParaClientFromPosition(position);

            List<ParagraphResult> listResults = new List<ParagraphResult>(0);

            if(cpc != null)
            {
                listResults.Add(cpc.CreateParagraphResult());
            }

            return new ReadOnlyCollection<ParagraphResult>(listResults);
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:20,代码来源:TableParaClient.cs


示例20: GetRectangleFromRowEndPosition

        internal Rect GetRectangleFromRowEndPosition(ITextPointer position)
        {
            Debug.Assert(   TableParagraph.Table != null
                        &&  CalculatedColumns != null  );

            PTS.FSTABLEROWDESCRIPTION[] arrayTableRowDesc;
            PTS.FSKUPDATE fskupdTable;
            PTS.FSRECT rectTable;

            if (QueryTableDetails(out arrayTableRowDesc, out fskupdTable, out rectTable))
            {
                int vrCur = GetTableOffsetFirstRowTop() + rectTable.v;

                for (int iR = 0; iR < arrayTableRowDesc.Length; ++iR)
                {
                    TableRow row = ((RowParagraph)(PtsContext.HandleToObject(arrayTableRowDesc[iR].fsnmRow))).Row;

                    if(((TextPointer)position).CompareTo(row.ContentEnd) == 0)
                    {
                        return new Rect( TextDpi.FromTextDpi(rectTable.u + rectTable.du),
                                         TextDpi.FromTextDpi(vrCur),
                                         1.0,
                                         TextDpi.FromTextDpi(arrayTableRowDesc[iR].u.dvrRow));
                    }

                    vrCur += arrayTableRowDesc[iR].u.dvrRow;
                }
            }

            // Valid row end position should have been specified.
            Debug.Assert(false);

            return System.Windows.Rect.Empty;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:34,代码来源:TableParaClient.cs



注:本文中的ITextPointer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# ITextProvider类代码示例发布时间:2022-05-24
下一篇:
C# ITextOutput类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap