Console.Title プロパティ
アセンブリ: mscorlib (mscorlib.dll 内)
構文
/** @property */ public static String get_Title () /** @property */ public static void set_Title (String value)
コンソールのタイトル バーに表示される文字列。タイトル文字列の最大長は 24500 文字です。
Windows 95, Windows 98, Windows 98 Second Edition, Windows Millennium Edition プラットフォームメモ : タイトル文字列の最大長は ANSI 文字 127 個分です。Unicode 文字はサポートされません。
Title プロパティの使用例を次に示します。この例では、オペレーティング システム ウィンドウの現在のタイトルを表示して、キーが押されるのを待機した後、新しいタイトルを表示します。
' This example demonstrates the Console.Title property. Imports System Imports Microsoft.VisualBasic 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 'Main 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.) '
// 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. 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. import System.*; class Sample { public static void main(String[] args) { Console.WriteLine("The current console title is: \"{0}\"" , Console.get_Title()); Console.WriteLine(" (Press any key to change the console title.)"); Console.ReadKey(true); Console.set_Title("The title has changed!"); Console.WriteLine("Note that the new console title is \"{0}\"\n" + " (Press any key to quit.)", Console.get_Title()); Console.ReadKey(true); } //main } //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.) */
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。
参照
- Console.Title プロパティのページへのリンク