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

C# LogicalDirection类代码示例

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

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



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

示例1: IncrementalSearch

 public IncrementalSearch(TextArea textArea, LogicalDirection direction)
 {
     if (textArea == null)
                         throw new ArgumentNullException("textArea");
                 this.textArea = textArea;
                 this.direction = direction;
 }
开发者ID:voland,项目名称:ViSD,代码行数:7,代码来源:HandIncrementalSearch.cs


示例2: GetPositionAtWordBoundary

        /// <summary>

        /// 1.  When wordBreakDirection = Forward, returns a position at the end of the word,

        ///     i.e. a position with a wordBreak character (space) following it.

        /// 2.  When wordBreakDirection = Backward, returns a position at the start of the word,

        ///     i.e. a position with a wordBreak character (space) preceeding it.

        /// 3.  Returns null when there is no workbreak in the requested direction.

        /// </summary>

        private static TextPointer GetPositionAtWordBoundary(TextPointer position, LogicalDirection wordBreakDirection)
        {

            if (!position.IsAtInsertionPosition)
            {

                position = position.GetInsertionPosition(wordBreakDirection);

            }



            TextPointer navigator = position;

            while (navigator != null && !IsPositionNextToWordBreak(navigator, wordBreakDirection))
            {

                navigator = navigator.GetNextInsertionPosition(wordBreakDirection);

            }



            return navigator;

        }
开发者ID:ittray,项目名称:LocalDemo,代码行数:40,代码来源:WordBreaker.cs


示例3: IsContentHighlighted

        // Returns true iff the indicated content has scoping highlights.
        internal override bool IsContentHighlighted(StaticTextPointer textPosition, LogicalDirection direction)
        {
            int segmentCount;
            TextSegment textSegment;

            // No highlight when the selection is for interim character.
            if (_selection.IsInterimSelection)
            {
                return false;
            }

            // Check all segments of selection
            List<TextSegment> textSegments = _selection.TextSegments;
            segmentCount = textSegments.Count;
            for (int segmentIndex = 0; segmentIndex < segmentCount; segmentIndex++)
            {
                textSegment = textSegments[segmentIndex];

                if ((direction == LogicalDirection.Forward && textSegment.Start.CompareTo(textPosition) <= 0 && textPosition.CompareTo(textSegment.End) < 0) || //
                    (direction == LogicalDirection.Backward && textSegment.Start.CompareTo(textPosition) < 0 && textPosition.CompareTo(textSegment.End) <= 0))
                {
                    return true;
                }

            }
            return false;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:28,代码来源:TextSelectionHighlightLayer.cs


示例4: IsPositionNextToWordBreak

        // Helper for GetPositionAtWordBoundary.
        // Returns true when passed TextPointer is next to a wordBreak in requested direction.
        private static bool IsPositionNextToWordBreak(TextPointer position, LogicalDirection wordBreakDirection)
        {
            bool isAtWordBoundary = false;

            // Skip over any formatting.
            if (position.GetPointerContext(wordBreakDirection) != TextPointerContext.Text)
            {
                position = position.GetInsertionPosition(wordBreakDirection);
            }

            if (position.GetPointerContext(wordBreakDirection) == TextPointerContext.Text)
            {
                LogicalDirection oppositeDirection = (wordBreakDirection == LogicalDirection.Forward) ?
                    LogicalDirection.Backward : LogicalDirection.Forward;

                char[] runBuffer = new char[1];
                char[] oppositeRunBuffer = new char[1];

                position.GetTextInRun(wordBreakDirection, runBuffer, /*startIndex*/0, /*count*/1);
                position.GetTextInRun(oppositeDirection, oppositeRunBuffer, /*startIndex*/0, /*count*/1);

                if (runBuffer[0] == ' ' && !(oppositeRunBuffer[0] == ' '))
                {
                    isAtWordBoundary = true;
                }
            }
            else
            {
                // If we're not adjacent to text then we always want to consider this position a "word break".
                // In practice, we're most likely next to an embedded object or a block boundary.
                isAtWordBoundary = true;
            }

            return isAtWordBoundary;
        }
开发者ID:Klaudit,项目名称:inbox2_desktop,代码行数:37,代码来源:WordBreaker.cs


示例5: VerifyDirection

 // Throws an ArgumentException if direction is not a valid enum.
 internal static void VerifyDirection(LogicalDirection direction, string argumentName)
 {
     if (direction != LogicalDirection.Forward &&
         direction != LogicalDirection.Backward)
     {
         throw new InvalidEnumArgumentException(argumentName, (int)direction, typeof(LogicalDirection));
     }
 }
开发者ID:JianwenSun,项目名称:cc,代码行数:9,代码来源:ValidationHelper.cs


示例6: BplReferenceValue

 /// <summary>Creates a new <see cref="BplReferenceValue"/> instance.</summary>
 public BplReferenceValue(LogicalDirection direction, BplReferenceKind kind, string property, object reference) {
    Direction = direction;
    Kind = kind;
    Property = property;
    if (reference.IsA<BplObject>()) {
       Path = new BplPropertyPath(reference).ToString();
    }
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:9,代码来源:BplReferenceValue.cs


示例7: GetNextCaretPosition

 /// <inheritdoc/>
 public override int GetNextCaretPosition(int visualColumn, LogicalDirection direction, CaretPositioningMode mode)
 {
     int textOffset = parentVisualLine.StartOffset + this.RelativeTextOffset;
     int pos = TextUtilities.GetNextCaretPosition(parentVisualLine.Document, textOffset + visualColumn - this.VisualColumn, direction, mode);
     if (pos < textOffset || pos > textOffset + this.DocumentLength)
         return -1;
     else
         return this.VisualColumn + pos - textOffset;
 }
开发者ID:richardschneider,项目名称:ILSpy,代码行数:10,代码来源:VisualLineText.cs


示例8: GetNextChangePosition

        // Returns the position of the next highlight start or end in an
        // indicated direction, or null if there is no such position.
        internal override StaticTextPointer GetNextChangePosition(StaticTextPointer textPosition, LogicalDirection direction)
        {
            StaticTextPointer transitionPosition;
            AttributeRange attributeRange;
            int i;

            transitionPosition = StaticTextPointer.Null;

            // Use a simple iterative search since we don't ever have
            // more than a handful of attributes in a composition.

            if (direction == LogicalDirection.Forward)
            {
                for (i = 0; i < _attributeRanges.Count; i++)
                {
                    attributeRange = (AttributeRange)_attributeRanges[i];

                    if (attributeRange.Start.CompareTo(attributeRange.End) != 0)
                    {
                        if (textPosition.CompareTo(attributeRange.Start) < 0)
                        {
                            transitionPosition = attributeRange.Start.CreateStaticPointer();
                            break;
                        }
                        else if (textPosition.CompareTo(attributeRange.End) < 0)
                        {
                            transitionPosition = attributeRange.End.CreateStaticPointer();
                            break;
                        }
                    }
                }
            }
            else
            {
                for (i = _attributeRanges.Count - 1; i >= 0; i--)
                {
                    attributeRange = (AttributeRange)_attributeRanges[i];

                    if (attributeRange.Start.CompareTo(attributeRange.End) != 0)
                    {
                        if (textPosition.CompareTo(attributeRange.End) > 0)
                        {
                            transitionPosition = attributeRange.End.CreateStaticPointer();
                            break;
                        }
                        else if (textPosition.CompareTo(attributeRange.Start) > 0)
                        {
                            transitionPosition = attributeRange.Start.CreateStaticPointer();
                            break;
                        }
                    }
                }
            }

            return transitionPosition;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:58,代码来源:DisplayAttributeHighlightLayer.cs


示例9: PasswordTextPointer

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

        #region Constructors

        // Creates a new PasswordTextPointer instance.
        internal PasswordTextPointer(PasswordTextContainer container, LogicalDirection gravity, int offset)
        {
            Debug.Assert(offset >= 0 && offset <= container.SymbolCount, "Bad PasswordTextPointer offset!");

            _container = container;
            _gravity = gravity;
            _offset = offset;

            container.AddPosition(this);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:19,代码来源:PasswordTextNavigator.cs


示例10: GetNextCaretPosition

			public override int GetNextCaretPosition(int visualColumn, LogicalDirection direction, CaretPositioningMode mode)
			{
				// only place a caret stop before the newline, no caret stop after it
				if (visualColumn > this.VisualColumn && direction == LogicalDirection.Backward ||
				    visualColumn < this.VisualColumn && direction == LogicalDirection.Forward)
				{
					return this.VisualColumn;
				} else {
					return -1;
				}
			}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:11,代码来源:NewLineElementGenerator.cs


示例11: 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


示例12: TextGlyph

 /// <summary>Creates a new <see cref="TextGlyph"/> instance from the given parameters.</summary>
 public TextGlyph(string text, Font font, TextOverflow textOverflow, LogicalDirection textOverflowDirection, Vector sharpnessVector) {
    Text = text;
    Font = font;
    TextOverflow = textOverflow;
    TextOverflowDirection = textOverflowDirection;
    SharpnessVector = sharpnessVector;
    _prepareVisualText(Text);
    var result = _buildGlyph(false, Double.PositiveInfinity);
    if (result != null) {
       _fullRun = result.GlyphRun;
       Size = new Size(result.Width, result.Height);
       Baseline = result.Baseline;
    }
 }
开发者ID:borkaborka,项目名称:gmit,代码行数:15,代码来源:TextGlyph.cs


示例13: GetHighlightValue

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // Returns the value of a property stored on scoping highlight, if any.
        //
        // If no property value is set, returns DependencyProperty.UnsetValue.
        internal override object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction)
        {
            object value;

            if (IsContentHighlighted(textPosition, direction))
            {
                value = _selectedValue;
            }
            else
            {
                value = DependencyProperty.UnsetValue;
            }

            return value;
        }
开发者ID:JianwenSun,项目名称:cc,代码行数:26,代码来源:TextSelectionHighlightLayer.cs


示例14: GetHighlightValue

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // Returns the value of a property stored on scoping highlight, if any.
        //
        // If no property value is set, returns DependencyProperty.UnsetValue.
        internal override object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction)
        {
            AttributeRange attributeRange;
            object value;

            value = DependencyProperty.UnsetValue;

            attributeRange = GetRangeAtPosition(textPosition, direction);
            if (attributeRange != null)
            {
                value = attributeRange.TextDecorations;
            }

            return value;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:26,代码来源:DisplayAttributeHighlightLayer.cs


示例15:

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        /// <summary>
        /// <see cref="ITextPointer.SetLogicalDirection"/>
        /// </summary>
        void ITextPointer.SetLogicalDirection(LogicalDirection direction)
        {
            Debug.Assert(!_isFrozen, "Can't reposition a frozen pointer!");

            if (direction != _gravity)
            {
                // We need to remove the position from the container since we're
                // going to change its gravity, which changes its internal sort order.
                this.Container.RemovePosition(this);

                _gravity = direction;

                // Now start tracking the position again, at it's new sort order.
                this.Container.AddPosition(this);
            }
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:27,代码来源:PasswordTextNavigator.cs


示例16: 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


示例17: WordParser

 public WordParser(string text, LogicalDirection direction)
 {
     __Text = text;
     __DirectionToSearch = direction;
     if (direction == LogicalDirection.Backward)
         __State = WordParserState.WitespacesBeforeWord;
     else
     {
         if (text.Length == 0)
             __State = WordParserState.WitespacesBeforeWord;
         else
         {
             if (symbols.Contains(__Text[0]))
                 __State = WordParserState.ParsingSymbol;
             else if (whitespaces.Contains(__Text[0]))
                 __State = WordParserState.WitespacesBeforeWord;
             else
                 __State = WordParserState.ParsingText;
         }
     }
 }
开发者ID:fednep,项目名称:UV-Outliner,代码行数:21,代码来源:WordParser.cs


示例18: IsAtWordBoundary

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        // Returns true if position points to a word break in the supplied
        // char array.  position is an inter-character offset -- 0 points
        // to the space preceeding the first char, 1 points between the
        // first and second char, etc.
        //
        // insideWordDirection specifies whether we're looking for a word start
        // or word end.  If insideWordDirection == LogicalDirection.Forward, then
        // text = "abc def", position = 4 will return true, but if the direction is
        // backward, no word boundary will be found (looking backward position is
        // at the edge of whitespace, not a word).
        //
        // This method requires at least MinContextLength chars ahead of and
        // following position to give accurate results, but no more.
        internal static bool IsAtWordBoundary(char[] text, int position, LogicalDirection insideWordDirection)
        {
            CharClass[] classes = GetClasses(text);

            // If the inside text is blank, it's not a word boundary.
            if (insideWordDirection == LogicalDirection.Backward)
            {
                if (position == text.Length)
                {
                    return true;
                }
                if (position == 0 || IsWhiteSpace(text[position - 1], classes[position - 1]))
                {
                    return false;
                }
            }
            else
            {
                if (position == 0)
                {
                    return true;
                }
                if (position == text.Length || IsWhiteSpace(text[position], classes[position]))
                {
                    return false;
                }
            }

            UInt16[] charType3 = new UInt16[2];

            SafeNativeMethods.GetStringTypeEx(0 /* ignored */, SafeNativeMethods.CT_CTYPE3, new char[] { text[position - 1], text[position] }, 2, charType3);

            // Otherwise we're at a word boundary if the classes of the surrounding text differ.
            return IsWordBoundary(text[position - 1], text[position]) ||
                   (
                    !IsSameClass(charType3[0], classes[position - 1], charType3[1], classes[position]) &&
                    !IsMidLetter(text, position - 1, classes) &&
                    !IsMidLetter(text, position, classes) 
                   );
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:61,代码来源:SelectionWordBreaker.cs


示例19: GetHighlightValue

        //------------------------------------------------------
        //
        //  Internal Methods
        //
        //------------------------------------------------------

        #region Internal Methods

        /// <summary>
        /// Returns the value of a property stored on scoping highlight, if any.
        /// </summary>
        /// <param name="textPosition">
        /// Position to query.
        /// </param>
        /// <param name="direction">
        /// Direction of content to query.
        /// </param>
        /// <param name="highlightLayerOwnerType">
        /// Type of the matching highlight layer owner.
        /// </param>
        /// <returns>
        /// The highlight value if set on any scoping highlight.  If no property
        /// value is set, returns DependencyProperty.UnsetValue.
        /// </returns>
        internal virtual object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction, Type highlightLayerOwnerType)
        {
            int layerIndex;
            object value;
            HighlightLayer layer;

            value = DependencyProperty.UnsetValue;

            // Take the value on the closest layer.  "Closest" == added first.
            for (layerIndex = 0; layerIndex < this.LayerCount; layerIndex++)
            {
                layer = GetLayer(layerIndex);

                if (layer.OwnerType == highlightLayerOwnerType)
                {
                    value = layer.GetHighlightValue(textPosition, direction);
                    if (value != DependencyProperty.UnsetValue)
                        break;
                }
            }

            return value;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:47,代码来源:Highlights.cs


示例20: default

 int System.Windows.Documents.ITextPointer.GetTextInRun(LogicalDirection direction, char[] textBuffer, int startIndex, int count)
 {
   return default(int);
 }
开发者ID:asvishnyakov,项目名称:CodeContracts,代码行数:4,代码来源:System.Windows.Documents.TextPointer.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Login类代码示例发布时间:2022-05-24
下一篇:
C# Logic类代码示例发布时间: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