Compartir a través de


DTE2.ActiveDocument (Propiedad)

Obtiene el documento activo.

Espacio de nombres:  EnvDTE80
Ensamblado:  EnvDTE80 (en EnvDTE80.dll)

Sintaxis

'Declaración
ReadOnly Property ActiveDocument As Document
    Get
Document ActiveDocument { get; }
property Document^ ActiveDocument {
    Document^ get ();
}
abstract ActiveDocument : Document
function get ActiveDocument () : Document

Valor de propiedad

Tipo: EnvDTE.Document
Objeto Document.

Implementaciones

_DTE.ActiveDocument

Comentarios

Un documento activo es aquél que tiene el foco. Para que otro documento sea el documento activo, hay que establecer el foco en su ventana.

Sólo se puede establecer la leyenda en ventanas de tipo Tool. Si intenta establecer la leyenda en otro tipo de ventana, como ventanas de tipo Document, obtendrá un "Error no especificado".

Ejemplos

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

Seguridad de .NET Framework

Vea también

Referencia

DTE2 Interfaz

ActiveDocument (Sobrecarga)

EnvDTE80 (Espacio de nombres)