Aracılığıyla paylaş


EditPoint.DeleteWhitespace Yöntem

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

Ad alanı:  EnvDTE
Derleme:  EnvDTE (EnvDTE.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 veya TextSelection çevresinde beyaz (boş) alan ilk metni Pano'ya kopyalamadan kaldırır.Direction Olan vsWhitespaceOptionsHorizontal, sonra DeleteWhitespace siler boşluk ve sekme karakterleri düzenleme her iki tarafında noktası başlangıç ve düzenleme noktası satırın sonuna veya olmayan bir karakter kadar boşluk karşılaştı.Direction Olan vsWhitespaceOptionsVertical, sonra DeleteWhitespace Düzen her iki tarafındaki boş satırları siler noktası başına ve sonuna kadar belge veya boş olmayan bir satır kadar karşılaşılır.Direction Olan vsWhitespaceOptionsVerticalve geçerli satır boş değilse, daha sonra bu yöntem, hiç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

EditPoint Arabirim

EnvDTE Ad Alanı

Diğer Kaynaklar

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