Share via


Proprietà DTE2.ActiveDocument

ottiene il documento attivo.

Spazio dei nomi:  EnvDTE80
Assembly:  EnvDTE80 (in EnvDTE80.dll)

Sintassi

'Dichiarazione
ReadOnly Property ActiveDocument As Document
Document ActiveDocument { get; }
property Document^ ActiveDocument {
    Document^ get ();
}
abstract ActiveDocument : Document
function get ActiveDocument () : Document

Valore proprietà

Tipo: EnvDTE.Document
In Document oggetto.

Note

Un documento attivo è quella che ha lo stato attivo.Per fare un altro attivo del documento, impostare lo stato attivo sulla finestra.

È possibile impostare la barra del titolo delle finestre degli strumenti.Se si tenta di impostare la barra del titolo su altri tipi di finestre, ad esempio le finestre di documento, viene generato l'errore, “errore non specificato.„

Esempi

Sub ActiveDocumentExample()
  Dim objTextDoc As TextDocument
  Dim objEP As EditPoint
  
  ' Create a new text document.
  Call DTE2.ItemOperations.NewFile("General\Text File")
  'Get a handle to the new document.
  Set objTextDoc = DTE2.ActiveDocument.Object("TextDocument")
  Set objEP = objTextDoc.StartPoint.CreateEditPoint
  'Create an EditPoint and add some text.
  objEP.Insert "A test sentence."
End Sub

Sub DocumentExample()
  Dim doc As Document
  Dim desc As String

  Set doc = DTE2.ActiveDocument
  desc = "You are editing a "
  If (doc.ReadOnly) Then
    desc = desc & "read-only"
  Else
    desc = desc & "writable"
  End If
  desc = desc & " document called " & doc.Name & " located at " & doc.Path
  MsgBox desc
End Sub

Sicurezza di .NET Framework

Vedere anche

Riferimenti

DTE2 Interfaccia

Overload ActiveDocument

Spazio dei nomi EnvDTE80