Help2.Contents 方法
選取 [ 內容瀏覽視窗,並開啟它,如果它被關閉。
命名空間: Microsoft.VisualStudio.VSHelp80
組件: Microsoft.VisualStudio.VSHelp80 (在 Microsoft.VisualStudio.VSHelp80.dll 中)
語法
'宣告
Sub Contents
void Contents()
void Contents()
abstract Contents : unit -> unit
function Contents()
範例
建立Visual Studio嵌入式管理單元使用Visual C#中所述如何:建立增益集。 Add references to Microsoft.VisualStudio.VSHelp, Microsoft.VisualStudio.VSHelp80, and System.Windows.Forms. 在程式碼取代OnConnection Connect.cs 檔,下列程式碼中的方法。 執行程式碼範例中所述如何:編譯和執行 Automation 物件模型程式碼範例。
using System;
using Extensibility;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.VSHelp;
using Microsoft.VisualStudio.VSHelp80;
using System.Windows.Forms;
public void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
HelpContentsExample(_applicationObject);
}
public void HelpContentsExample(DTE2 dte)
{
// This opens Document Explorer and sets
// focus on the Contents window.
try
{
Microsoft.VisualStudio.VSHelp80.Help2 help2 =
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject
("Help2");
// Open Document Explorer and set focus on Contents window.
help2.Contents();
}
catch (SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。