مشاركة عبر


EditPoint.DeleteWhitespace أسلوب

حذف أحرف فارغ (أبيض مسافة) أفقياً أو عمودياً حول الموقع الحالي في احتياطي للنص.

مساحة الاسم:  EnvDTE
التجميع:  EnvDTE (في EnvDTE.dll)

بناء الجملة

'إقرار
Sub DeleteWhitespace ( _
    Direction As vsWhitespaceOptions _
)
void DeleteWhitespace(
    vsWhitespaceOptions Direction
)
void DeleteWhitespace(
    [InAttribute] vsWhitespaceOptions Direction
)
abstract DeleteWhitespace : 
        Direction:vsWhitespaceOptions -> unit 
function DeleteWhitespace(
    Direction : vsWhitespaceOptions
)

المعلمات

ملاحظات

DeleteWhitespaceيزيل أبيض المساحة (فارغ) حول يؤشر التحرير أو TextSelection دون نسخ نص أول إلى حافظة. إذا Directionهو vsWhitespaceOptionsHorizontal، ثم DeleteWhitespaceحذف المسافات وعلامات الجدولة تشغيل كلا جانبي التحرير يؤشر بداية ونهاية السطر ليؤشر التحرير، أو حتى حرف التي هو مسافة بيضاء غير هو مصادفة. إذا Directionهو vsWhitespaceOptionsVertical، ثم DeleteWhitespaceحذف الأسطر الفارغة تشغيل جانبي التحرير يؤشر بداية وإنهاء مستند، أو حتى سطر الذي هو غير فارغ هو مصادفة. إذا Directionهو vsWhitespaceOptionsVertical، والخط الحالي هو غير فارغ، ثم th هو يقوم أسلوب لا شيء.

أمثلة

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.

راجع أيضًَا

المرجع

EditPoint واجهة

EditPoint الأعضاء

EnvDTE مساحة الاسم

موارد أخرى

كيفية: الترجمة وإعادة تشغيل أمثلة التعليمات البرمجية لطراز كائن التنفيذ التلقائي