共用方式為


HTMLWindow.Parent 屬性

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

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

語法

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

屬性值

型別:EnvDTE.Window
Window 物件。

備註

Parent 屬性會將直接上層父代傳給物件或集合。

範例

public void CodeExample(DTE2 dte, AddIn addin)
{
   // Make sure you have an open HTML document before running this example.
    try
    {
        if (dte.ActiveDocument.ActiveWindow.Object is HTMLWindow)
        {
            HTMLWindow htmlwin;
            string msg = "";
            htmlwin = dte.ActiveDocument.ActiveWindow.Object as HTMLWindow;
            // Show the related application object's name.
            msg += "The application containing this HTMLWindow is " + htmlwin.DTE.Name;
            // Show the HTMLWindow's parent object.
            msg += "\nThe HTMLWindow's parent object is " + htmlwin.Parent.Type.ToString();
            MessageBox.Show(msg);
        }
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 安全性

請參閱

參考

HTMLWindow 介面

EnvDTE 命名空間

其他資源

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