当前位置: 首页>>代码示例>>C#>>正文


C# DocumentLine.GetVisualColumn方法代码示例

本文整理汇总了C#中Mono.TextEditor.DocumentLine.GetVisualColumn方法的典型用法代码示例。如果您正苦于以下问题:C# DocumentLine.GetVisualColumn方法的具体用法?C# DocumentLine.GetVisualColumn怎么用?C# DocumentLine.GetVisualColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mono.TextEditor.DocumentLine的用法示例。


在下文中一共展示了DocumentLine.GetVisualColumn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DrawLinePortion

        int DrawLinePortion(Context cr, ChunkStyle style, TextLayout layout, DocumentLine line, int visualOffset, int logicalLength)
        {
            int logicalColumn = line.GetLogicalColumn(editor, visualOffset);
            int logicalEndColumn = logicalColumn + logicalLength;
            int visualEndOffset = line.GetVisualColumn(editor, logicalEndColumn);

            int visualLength = visualEndOffset - visualOffset;

            int indexOffset = visualOffset - 1;

            layout.SetFontStyle(style.FontStyle, indexOffset, visualLength);
            layout.SetFontWeight(style.FontWeight, indexOffset, visualLength);
            if (style.Underline)
                layout.SetUnderline(indexOffset, visualLength);
            layout.SetForeground(style.Foreground, indexOffset, visualLength);

            return visualEndOffset;
        }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:18,代码来源:TextViewMargin.cs

示例2: ColumnToX

        public double ColumnToX(DocumentLine line, int column)
        {
            int visualColumn = line.GetVisualColumn(editor, column);

            return (visualColumn - 1) * CharWidth;
        }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:6,代码来源:TextViewMargin.cs

示例3: DrawBackground

        protected internal override void DrawBackground(Context cr, Xwt.Rectangle area, DocumentLine line, int lineNumber, double x, double y, double height)
        {
            if (line == null) return;

            if (lineNumber == editor.Caret.Line)
            {
                cr.SetColor(editor.Options.ColorScheme.LineMarker.Color);
                cr.Rectangle(x, y, editor.GetWidth(), height);
                cr.Fill();
            }

            var style = SyntaxModeService.DefaultColorStyle;
            var selectionStyle = editor.HasFocus ? style.SelectedText : style.SelectedInactiveText;

            var selectionSegment = GetSegmentForLine(editor.Selection, line);
            if (selectionSegment != null)
            {
                int logicalStartColumn = selectionSegment.Value.Offset - line.Offset;
                int visualStartColumn = line.GetVisualColumn(editor, logicalStartColumn);

                if (selectionSegment.Value.Offset == line.Offset)
                    visualStartColumn = 0;

                int logicalEndColumn = selectionSegment.Value.EndOffset - line.Offset;
                int visualEndColumn = line.GetVisualColumn(editor, logicalEndColumn);

                if (editor.Selection.EndOffset != selectionSegment.Value.EndOffset && visualEndColumn > 0)
                    visualEndColumn--;

                if (editor.Selection.Contains(line.EndOffset))
                    ++visualEndColumn;

                cr.SetColor(selectionStyle.Background);
                double startX = x + visualStartColumn * CharWidth;
                double endX = x + visualEndColumn * CharWidth;
                cr.Rectangle(startX, y, endX - startX, LineHeight);
                cr.Fill();
            }
        }
开发者ID:cra0zy,项目名称:XwtPlus.TextEditor,代码行数:39,代码来源:TextViewMargin.cs


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