Console.Title Console.Title Console.Title Console.Title Property

Definición

Obtiene o establece el título que se va a mostrar en la barra de título de la consola.Gets or sets the title to display in the console title bar.

public:
 static property System::String ^ Title { System::String ^ get(); void set(System::String ^ value); };
public static string Title { get; set; }
member this.Title : string with get, set
Public Shared Property Title As String

Valor de propiedad

Cadena que se va a mostrar en la barra de título de la consola.The string to be displayed in the title bar of the console. La cadena de título tiene una longitud máxima de 24.500 caracteres.The maximum length of the title string is 24500 characters.

Excepciones

En una operación get, el título recuperado tiene más de 24.500 caracteres.In a get operation, the retrieved title is longer than 24500 characters.

En una operación set, el título especificado tiene más de 24.500 caracteres.In a set operation, the specified title is longer than 24500 characters.

En una operación set, el título especificado es null.In a set operation, the specified title is null.

Error de E/S.An I/O error occurred.

Se invoca la operación Get en un sistema operativo distinto de Windows.The get operation is invoked on an operating system other than Windows.

Ejemplos

En este ejemplo se Title muestra la propiedad.This example demonstrates the Title property. En el ejemplo se muestra el título actual de la ventana del sistema operativo, se espera a que se presione una tecla y, a continuación, se muestra un nuevo título.The example displays the current title of the operating system window, waits for a key press, then displays a new title.

// This example demonstrates the Console.Title property.
using namespace System;
int main()
{
   Console::WriteLine( "The current console title is: \"{0}\"", Console::Title );
   Console::WriteLine( "  (Press any key to change the console title.)" );
   Console::ReadKey( true );
   Console::Title = "The title has changed!";
   Console::WriteLine( "Note that the new console title is \"{0}\"\n"
   "  (Press any key to quit.)", Console::Title );
   Console::ReadKey( true );
}

/*
This example produces the following results:

>myTitle
The current console title is: "Command Prompt - myTitle"
  (Press any key to change the console title.)
Note that the new console title is "The title has changed!"
  (Press any key to quit.)

*/
// This example demonstrates the Console.Title property.
using System;

class Sample 
{
    public static void Main() 
    {
    Console.WriteLine("The current console title is: \"{0}\"",
                      Console.Title);
    Console.WriteLine("  (Press any key to change the console title.)");
    Console.ReadKey(true);
    Console.Title = "The title has changed!";
    Console.WriteLine("Note that the new console title is \"{0}\"\n" +
                      "  (Press any key to quit.)", Console.Title);
    Console.ReadKey(true);
    }
}
/*
This example produces the following results:

>myTitle
The current console title is: "Command Prompt - myTitle"
  (Press any key to change the console title.)
Note that the new console title is "The title has changed!"
  (Press any key to quit.)

*/
' This example demonstrates the Console.Title property.
Class Sample
   Public Shared Sub Main()
      Console.WriteLine("The current console title is: ""{0}""", Console.Title)
      Console.WriteLine("  (Press any key to change the console title.)")
      Console.ReadKey(True)
      Console.Title = "The title has changed!"
      Console.WriteLine("Note that the new console title is ""{0}""" & vbCrLf & _
                        "  (Press any key to quit.)", Console.Title)
      Console.ReadKey(True)
   End Sub
End Class
'
'This example produces the following results:
'
'>myTitle
'The current console title is: "Command Prompt - myTitle"
'  (Press any key to change the console title.)
'Note that the new console title is "The title has changed!"
'  (Press any key to quit.)
'

Seguridad

UIPermission
para modificar ventanas y subventanas seguras de nivel superior.for modifying safe top-level windows and subwindows. Enumeración asociada:SafeTopLevelWindowsAssociated enumeration: SafeTopLevelWindows

Se aplica a