Aracılığıyla paylaş


EditPoint2.DeleteWhitespace Yöntem (vsWhitespaceOptions)

Boş karakterler (boşluk), metin ara geçerli konumda çevresinde yatay veya dikey olarak siler.

Ad alanı:  EnvDTE80
Derleme:  EnvDTE80 (EnvDTE80.dll içinde)

Sözdizimi

'Bildirim
Sub DeleteWhitespace ( _
    Direction As vsWhitespaceOptions _
)
void DeleteWhitespace(
    vsWhitespaceOptions Direction
)
void DeleteWhitespace(
    [InAttribute] vsWhitespaceOptions Direction
)
abstract DeleteWhitespace : 
        Direction:vsWhitespaceOptions -> unit 
function DeleteWhitespace(
    Direction : vsWhitespaceOptions
)

Parametreler

Notlar

DeleteWhitespaceNokta Düzenlemeden beyaz boşluk (boş) kaldırır veya TextSelection ilk metni Pano'ya kopyalama.Direction Olan vsWhitespaceOptionsHorizontal, sonra DeleteWhitespace siler boşluk ve sekme karakterleri düzenleme her iki tarafındaki başlangıca işaret ve son düzenleme noktanın satırının veya beyaz boşluk karakteri gelene kadar.Direction Olan vsWhitespaceOptionsVertical, sonra DeleteWhitespace Düzen her iki tarafındaki boş satır başına'nın üzerine gelin ve belge veya boş olmayan satır karşılaşılana kadar sona siler.Direction Olan vsWhitespaceOptionsVerticalve geçerli satır boş değil ve bu yöntem bir şey yapmaz.

Örnekler

Sub DeleteWhitespaceExample(ByVal dte As DTE2)

    ' Create a new text file.
    dte.ItemOperations.NewFile()

    ' Create an EditPoint at the start of the new document.
    Dim doc As TextDocument = _
        CType(dte.ActiveDocument.Object("TextDocument"), TextDocument)
    Dim point As EditPoint = doc.StartPoint.CreateEditPoint

    Dim i, j As Integer

    ' Insert 10 lines of text.
    For i = 1 To 10
        point.Insert("This is a test." & vbCrLf)
    Next

    If MsgBox("Remove all spaces between words?", MsgBoxStyle.YesNo) _
        = MsgBoxResult.Yes Then
        point.StartOfDocument()

        For i = 1 To 10
            For j = 1 To 3
                point.WordRight()
                point.DeleteWhitespace( _
                    vsWhitespaceOptions.vsWhitespaceOptionsHorizontal)
            Next
            point.StartOfLine()
            point.LineDown()
        Next
    End If

End Sub
public void DeleteWhitespaceExample(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");

    if (MessageBox.Show("Remove all spaces between words?", "", 
        MessageBoxButtons.YesNo) == DialogResult.Yes)
    {
        point.StartOfDocument();

        for (int i = 1; i <= 10; ++i)
        {
            for (int j = 1; j <= 3; ++j)
            {
                point.WordRight(1);
                point.DeleteWhitespace(
                    vsWhitespaceOptions.vsWhitespaceOptionsHorizontal);
            }
            point.StartOfLine();
            point.LineDown(1);
        }
    }
}

.NET Framework Güvenliği

Ayrıca bkz.

Başvuru

EditPoint2 Arabirim

DeleteWhitespace Fazla Yük

EnvDTE80 Ad Alanı

Diğer Kaynaklar

Nasıl yapılır: derlemek ve Otomasyon nesne modeli kod örneklerini çalıştırmak