當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。