共用方式為


Find.Parent 屬性

取得 Find 物件的直屬父物件。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
ReadOnly Property Parent As DTE
DTE Parent { get; }
property DTE^ Parent {
    DTE^ get ();
}
abstract Parent : DTE with get
function get Parent () : DTE

屬性值

類型:EnvDTE.DTE
DTE 物件。

備註

Parent 屬性將直接上層父代傳回 Find 物件。

範例

public void Example(DTE2 dte)
{
   try
      {
      TextDocument objTextDoc;
      EditPoint objEditPoint;
      Find objFind;

      // Make an active text document before running this code.
      objTextDoc = (TextDocument)dte.ActiveDocument.Object("TextDocument");

      // Create editpoint.
      objEditPoint = objTextDoc.StartPoint.CreateEditPoint();
      objEditPoint.Insert("An additional line" + (Char)13);

      // Create Find.
      objFind = objTextDoc.DTE.Find;

      // Set Find options and execute.
      objFind.Action = vsFindAction.vsFindActionFind;
      objFind.FindWhat = "line";
      if (objFind.Execute() == vsFindResult.vsFindResultFound)
         MessageBox.Show("Text found in " + objFind.Parent.FullName + " application.");
      else
         MessageBox.Show("Text not found" + objFind.Parent.FullName + " application.");

      // Show Find object DTE property.
      MessageBox.Show(objFind.DTE.Name);
   }
   catch (Exception ex)
   {
      MessageBox.Show(ex.Message);
   }
}

.NET Framework 安全性

請參閱

參考

Find 介面

EnvDTE 命名空間

其他資源

如何:編譯和執行 Automation 物件模型程式碼範例