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

Определение

Возвращает или задает заголовок для отображения в строке заголовка консоли.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

Значение свойства

Строка для отображения в строке заголовка консоли.The string to be displayed in the title bar of the console. Максимальная длина строки заголовка — 24500 символов.The maximum length of the title string is 24500 characters.

Исключения

В операции get длина полученного заголовка превышает 24 500 символов.In a get operation, the retrieved title is longer than 24500 characters.

В операции set указанный заголовок длиннее 24500 символов.In a set operation, the specified title is longer than 24500 characters.

Для операции set задан заголовок null.In a set operation, the specified title is null.

Ошибка ввода/вывода.An I/O error occurred.

Операция получения вызывается в операционной системе, отличной от Windows.The get operation is invoked on an operating system other than Windows.

Примеры

В Title этом примере демонстрируется свойство.This example demonstrates the Title property. В примере отображается текущее название окна операционной системы, Ожидание нажатия клавиши, а затем отображается новый заголовок.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 'Sample
'
'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.)
'

Безопасность

UIPermission
для изменения безнадежных окон верхнего уровня и подокон.for modifying safe top-level windows and subwindows. Связанное перечисление:SafeTopLevelWindowsAssociated enumeration: SafeTopLevelWindows

Применяется к