Xwt.Drawing.TextLayout.SetForeground C# (CSharp) Method

SetForeground() public method

Sets the foreground color of a part of text inside the T:Xwt.Drawing.TextLayout object.
public SetForeground ( Color color, int startIndex, int count ) : void
color Color The color of the text.
startIndex int Start index of the first character to apply the foreground color to.
count int The number of characters to apply the foreground color to.
return void
		public void SetForeground (Color color, int startIndex, int count)
		{
			AddAttribute (new ColorTextAttribute () { StartIndex = startIndex, Count = count, Color = color });
		}

Usage Example

Ejemplo n.º 1
0
        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;
        }
All Usage Examples Of Xwt.Drawing.TextLayout::SetForeground