Export (0) Print
Expand All

EditPoint.DisplayColumn Property

Gets the number of the column number of the EditPoint object.

Namespace:  EnvDTE
Assembly:  EnvDTE (in EnvDTE.dll)

int DisplayColumn { get; }

Property Value

Type: System.Int32
The number of the currently displayed column containing the EditPoint object.

The column numbering starts at one. The display column may be different from the value of the LineCharOffset if the line contains tab characters. DisplayColumn uses the global setting for tab size to determine the displayed column.

public void DisplayColumnExample(DTE2 dte)
{
    // Create a new text file.
    dte.ItemOperations.NewFile(@"General\Text File", "", 
        Constants.vsViewKindPrimary);

    // Create an EditPoint at the start of the new document.
    TextDocument doc = 
        (TextDocument)dte.ActiveDocument.Object("TextDocument");
    EditPoint point = doc.StartPoint.CreateEditPoint();

    // Insert 10 lines of text.
    for (int i = 1; i <= 10; ++i)
        point.Insert("This is a test.\n");

    // Display EditPoint properties.
    MessageBox.Show(
        "AbsoluteCharOffset: " + point.AbsoluteCharOffset + "\n" + 
        "DisplayColumn: " + point.DisplayColumn + "\n" + 
        "AtEndOfDocument: " + point.AtEndOfDocument + "\n" + 
        "AtEndOfLine: " + point.AtEndOfLine + "\n" + 
        "AtStartOfDocument: " + point.AtStartOfDocument + "\n" + 
        "AtStartOfLine: " + point.AtStartOfLine);
}

Show:
© 2015 Microsoft